From 4c8148acf1adb0ebbe16f73c1fc56e8dd7afc03e Mon Sep 17 00:00:00 2001 From: Mathew Sutcliffe Date: Thu, 30 Oct 2014 22:08:22 +0000 Subject: [PATCH] refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template. --- src/blackmisc/audiodevice.cpp | 102 ----------------- src/blackmisc/audiodevice.h | 45 +------- src/blackmisc/avaircraft.cpp | 100 ----------------- src/blackmisc/avaircraft.h | 44 +------- src/blackmisc/avaircrafticao.cpp | 97 ----------------- src/blackmisc/avaircrafticao.h | 44 +------- src/blackmisc/avaircraftsituation.cpp | 78 ------------- src/blackmisc/avaircraftsituation.h | 35 +----- src/blackmisc/avairport.cpp | 100 ----------------- src/blackmisc/avairport.h | 44 +------- src/blackmisc/avairporticao.cpp | 109 ------------------- src/blackmisc/avairporticao.h | 47 +------- src/blackmisc/avatcstation.cpp | 100 ----------------- src/blackmisc/avatcstation.h | 44 +------- src/blackmisc/avcallsign.cpp | 109 ------------------- src/blackmisc/avcallsign.h | 47 +------- src/blackmisc/avflightplan.cpp | 65 ----------- src/blackmisc/avflightplan.h | 44 +------- src/blackmisc/avinformationmessage.cpp | 104 ------------------ src/blackmisc/avinformationmessage.h | 44 +------- src/blackmisc/avselcal.cpp | 99 ----------------- src/blackmisc/avselcal.h | 44 +------- src/blackmisc/eveventhotkeyfunction.cpp | 56 ---------- src/blackmisc/eveventhotkeyfunction.h | 29 +---- src/blackmisc/hotkeyfunction.cpp | 60 ---------- src/blackmisc/hotkeyfunction.h | 39 +------ src/blackmisc/hwjoystickbutton.cpp | 84 -------------- src/blackmisc/hwjoystickbutton.h | 47 +------- src/blackmisc/hwkeyboardkey.cpp | 66 ----------- src/blackmisc/hwkeyboardkey.h | 44 +------- src/blackmisc/icon.cpp | 100 ----------------- src/blackmisc/icon.h | 44 +------- src/blackmisc/logcategory.cpp | 48 -------- src/blackmisc/logcategory.h | 35 +----- src/blackmisc/namevariantpair.cpp | 100 ----------------- src/blackmisc/namevariantpair.h | 44 +------- src/blackmisc/nwaircraftmapping.cpp | 100 ----------------- src/blackmisc/nwaircraftmapping.h | 44 +------- src/blackmisc/nwaircraftmodel.cpp | 100 ----------------- src/blackmisc/nwaircraftmodel.h | 44 +------- src/blackmisc/nwclient.cpp | 100 ----------------- src/blackmisc/nwclient.h | 44 +------- src/blackmisc/nwserver.cpp | 100 ----------------- src/blackmisc/nwserver.h | 44 +------- src/blackmisc/nwtextmessage.cpp | 77 ------------- src/blackmisc/nwtextmessage.h | 35 +----- src/blackmisc/nwuser.cpp | 100 ----------------- src/blackmisc/nwuser.h | 44 +------- src/blackmisc/nwvoicecapabilites.cpp | 100 ----------------- src/blackmisc/nwvoicecapabilities.h | 44 +------- src/blackmisc/propertyindex.cpp | 102 ----------------- src/blackmisc/propertyindex.h | 44 +------- src/blackmisc/setaudio.cpp | 100 ----------------- src/blackmisc/setaudio.h | 44 +------- src/blackmisc/setkeyboardhotkey.cpp | 91 ---------------- src/blackmisc/setkeyboardhotkey.h | 44 +------- src/blackmisc/setnetwork.cpp | 100 ----------------- src/blackmisc/setnetwork.h | 44 +------- src/blackmisc/voiceroom.cpp | 101 ----------------- src/blackmisc/voiceroom.h | 45 +------- src/blacksim/fscommon/aircraftcfgentries.cpp | 92 ---------------- src/blacksim/fscommon/aircraftcfgentries.h | 41 +------ src/blacksim/fscommon/aircraftmapping.cpp | 84 -------------- src/blacksim/fscommon/aircraftmapping.h | 41 +------ src/blacksim/setsimulator.cpp | 100 ----------------- src/blacksim/setsimulator.h | 44 +------- src/blacksim/simulatorinfo.cpp | 58 ---------- src/blacksim/simulatorinfo.h | 41 +------ 68 files changed, 34 insertions(+), 4499 deletions(-) diff --git a/src/blackmisc/audiodevice.cpp b/src/blackmisc/audiodevice.cpp index bb69e2c51..750e6b2fe 100644 --- a/src/blackmisc/audiodevice.cpp +++ b/src/blackmisc/audiodevice.cpp @@ -35,57 +35,6 @@ namespace BlackMisc // void } - /* - * Compare - */ - int CAudioDevice::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAudioDevice::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAudioDevice::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CAudioDevice::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Equal? - */ - bool CAudioDevice::operator ==(const CAudioDevice &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - - /* - * Unequal? - */ - bool CAudioDevice::operator !=(const CAudioDevice &other) const - { - return !((*this) == other); - } - /* * As String */ @@ -99,56 +48,5 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CAudioDevice::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAudioDevice::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register - */ - void CAudioDevice::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CAudioDevice::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CAudioDevice::toJson() const - { - return BlackMisc::serializeJson(CAudioDevice::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CAudioDevice::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAudioDevice::jsonMembers(), TupleConverter::toTuple(*this)); - } - } // Voice } // BlackMisc diff --git a/src/blackmisc/audiodevice.h b/src/blackmisc/audiodevice.h index 78673029d..3251d8e61 100644 --- a/src/blackmisc/audiodevice.h +++ b/src/blackmisc/audiodevice.h @@ -25,7 +25,7 @@ namespace BlackMisc * If you want to safe this object, use the name instead of the index, since the index can change after * a restart. */ - class CAudioDevice : public BlackMisc::CValueObject + class CAudioDevice : public CValueObjectStdTuple { public: //! Type @@ -61,33 +61,6 @@ namespace BlackMisc //! Valid audio device object? bool isValid() const { return m_deviceIndex >= -1 && !m_deviceName.isEmpty(); } - //! Equal operator == - bool operator ==(const CAudioDevice &other) const; - - //! Unequal operator != - bool operator !=(const CAudioDevice &other) const; - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! \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); } - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - //! Device index for default device static qint16 defaultDeviceIndex() {return -1;} @@ -107,25 +80,9 @@ namespace BlackMisc } protected: - //! \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(CAudioDevice) //! Device type, @see CAudioDevice::DeviceType diff --git a/src/blackmisc/avaircraft.cpp b/src/blackmisc/avaircraft.cpp index 432fefaa5..b6aae0e51 100644 --- a/src/blackmisc/avaircraft.cpp +++ b/src/blackmisc/avaircraft.cpp @@ -41,22 +41,6 @@ namespace BlackMisc return s; } - /* - * Marshall to DBus - */ - void CAircraft::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAircraft::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - /* * Distance to plane */ @@ -142,58 +126,6 @@ namespace BlackMisc this->setTransponder(xpdr); } - /* - * Equal? - */ - bool CAircraft::operator ==(const CAircraft &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CAircraft::operator !=(const CAircraft &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CAircraft::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * metaTypeId - */ - int CAircraft::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAircraft::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CAircraft::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - /* * Property by index */ @@ -269,38 +201,6 @@ namespace BlackMisc } } - /* - * Register metadata - */ - void CAircraft::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To JSON - */ - QJsonObject CAircraft::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - /* - * From JSON - */ - void CAircraft::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - /* - * Members - */ - const QStringList &CAircraft::jsonMembers() - { - return TupleConverter::jsonMembers(); - } } // namespace } // namespace diff --git a/src/blackmisc/avaircraft.h b/src/blackmisc/avaircraft.h index 3cb568d24..6eb3037df 100644 --- a/src/blackmisc/avaircraft.h +++ b/src/blackmisc/avaircraft.h @@ -30,7 +30,7 @@ namespace BlackMisc /*! * Value object encapsulating information of an aircraft */ - class CAircraft : public BlackMisc::CValueObject, public BlackMisc::Geo::ICoordinateGeodetic + class CAircraft : public CValueObjectStdTuple, public Geo::ICoordinateGeodetic { public: //! Properties by index @@ -52,12 +52,6 @@ namespace BlackMisc //! Constructor. CAircraft(const CCallsign &callsign, const BlackMisc::Network::CUser &user, const CAircraftSituation &situation); - //! \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); } - //! \copydoc CValueObject::toIcon() virtual BlackMisc::CIcon toIcon() const override { return this->m_callsign.toIcon(); } @@ -216,52 +210,16 @@ namespace BlackMisc //! Meaningful default settings for Transponder void initTransponder(); - //! Equal operator == - bool operator ==(const CAircraft &other) const; - - //! Unequal operator != - bool operator !=(const CAircraft &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; - //! \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(); - protected: //! \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::marshallFromDbus() - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - private: BLACK_ENABLE_TUPLE_CONVERSION(CAircraft) CCallsign m_callsign; diff --git a/src/blackmisc/avaircrafticao.cpp b/src/blackmisc/avaircrafticao.cpp index 70c81991a..5858bbe31 100644 --- a/src/blackmisc/avaircrafticao.cpp +++ b/src/blackmisc/avaircrafticao.cpp @@ -31,48 +31,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CAircraftIcao::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAircraftIcao::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CAircraftIcao::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAircraftIcao::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAircraftIcao::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - /* * As string */ @@ -93,12 +51,6 @@ namespace BlackMisc return s; } - bool CAircraftIcao::operator ==(const CAircraftIcao &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - bool CAircraftIcao::matchesWildcardIcao(const CAircraftIcao &otherIcao) const { if ((*this) == otherIcao) return true; @@ -110,22 +62,6 @@ namespace BlackMisc return true; } - /* - * Unequal? - */ - bool CAircraftIcao::operator !=(const CAircraftIcao &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CAircraftIcao::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - /* * Property by index */ @@ -192,38 +128,5 @@ namespace BlackMisc return (regexp.match(designator).hasMatch()); } - /* - * Register metadata - */ - void CAircraftIcao::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To JSON - */ - QJsonObject CAircraftIcao::toJson() const - { - return BlackMisc::serializeJson(CAircraftIcao::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - void CAircraftIcao::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAircraftIcao::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CAircraftIcao::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - } // namespace } // namespace diff --git a/src/blackmisc/avaircrafticao.h b/src/blackmisc/avaircrafticao.h index 04e511f81..757ef53d3 100644 --- a/src/blackmisc/avaircrafticao.h +++ b/src/blackmisc/avaircrafticao.h @@ -22,7 +22,7 @@ namespace BlackMisc /*! * Value object for ICAO classification */ - class CAircraftIcao : public BlackMisc::CValueObject + class CAircraftIcao : public CValueObjectStdTuple { 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" diff --git a/src/blackmisc/avaircraftsituation.cpp b/src/blackmisc/avaircraftsituation.cpp index c958da454..888e20c80 100644 --- a/src/blackmisc/avaircraftsituation.cpp +++ b/src/blackmisc/avaircraftsituation.cpp @@ -34,75 +34,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CAircraftSituation::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAircraftSituation::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CAircraftSituation::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAircraftSituation::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAircraftSituation::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CAircraftSituation::operator ==(const CAircraftSituation &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CAircraftSituation::operator !=(const CAircraftSituation &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CAircraftSituation::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - /* * Property by index */ @@ -176,14 +107,5 @@ namespace BlackMisc } } - /* - * Register metadata - */ - void CAircraftSituation::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - } // namespace } // namespace diff --git a/src/blackmisc/avaircraftsituation.h b/src/blackmisc/avaircraftsituation.h index 4b3210e03..cbed4e516 100644 --- a/src/blackmisc/avaircraftsituation.h +++ b/src/blackmisc/avaircraftsituation.h @@ -26,7 +26,7 @@ namespace BlackMisc /*! * Value object encapsulating information of an aircraft's situation */ - class CAircraftSituation : public BlackMisc::CValueObject, public BlackMisc::Geo::ICoordinateGeodetic + class CAircraftSituation : public CValueObjectStdTuple, public Geo::ICoordinateGeodetic { public: //! Properties by index @@ -62,12 +62,6 @@ namespace BlackMisc //! \copydoc CValueObject::setPropertyByIndex(variant,index) virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override; - //! \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 position const BlackMisc::Geo::CCoordinateGeodetic &getPosition() const { return this->m_position; } @@ -119,37 +113,10 @@ namespace BlackMisc //! Timestamp const QDateTime &getTimestamp() const { return this->m_timestamp;} - //! Equal operator == - bool operator ==(const CAircraftSituation &other) const; - - //! Unequal operator != - bool operator !=(const CAircraftSituation &other) const; - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! Register metadata - static void registerMetadata(); - protected: //! \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(CAircraftSituation) BlackMisc::Geo::CCoordinateGeodetic m_position; diff --git a/src/blackmisc/avairport.cpp b/src/blackmisc/avairport.cpp index 14051292e..f8c63d788 100644 --- a/src/blackmisc/avairport.cpp +++ b/src/blackmisc/avairport.cpp @@ -65,89 +65,6 @@ namespace BlackMisc (void)QT_TRANSLATE_NOOP("Aviation", "ATC station"); } - /* - * Register metadata - */ - void CAirport::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CAirport::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CAirport::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - /* - * From Json - */ - void CAirport::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - /* - * Compare - */ - int CAirport::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAirport::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAirport::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CAirport::operator ==(const CAirport &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Hash - */ - uint CAirport::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Unequal? - */ - bool CAirport::operator !=(const CAirport &other) const - { - return !((*this) == other); - } - /* * Distance to planne */ @@ -225,22 +142,5 @@ namespace BlackMisc } } - /* - * metaTypeId - */ - int CAirport::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAirport::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - } // namespace } // namespace diff --git a/src/blackmisc/avairport.h b/src/blackmisc/avairport.h index 33dbb7bce..306ffeb8a 100644 --- a/src/blackmisc/avairport.h +++ b/src/blackmisc/avairport.h @@ -23,7 +23,7 @@ namespace BlackMisc /*! * Value object encapsulating information about an airpot. */ - class CAirport : public BlackMisc::CValueObject, public BlackMisc::Geo::ICoordinateGeodetic + class CAirport : public CValueObjectStdTuple, public Geo::ICoordinateGeodetic { public: //! Properties by index @@ -49,18 +49,6 @@ namespace BlackMisc //! ATC station constructor CAirport(const CAirportIcao &icao, const BlackMisc::Geo::CCoordinateGeodetic &position, const QString &descriptiveName); - //! \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); } - - //! Equal operator == - bool operator ==(const CAirport &other) const; - - //! Unequal operator != - bool operator !=(const CAirport &other) const; - //! Get ICAO code. const CAirportIcao &getIcao() const { return m_icao; } @@ -121,46 +109,16 @@ namespace BlackMisc return this->getPosition().longitude(); } - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const 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; - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! Register metadata - static void registerMetadata(); - - //! \copydoc TupleConverter::jsonMembers() - static const QStringList &jsonMembers(); - protected: //! \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(CAirport) CAirportIcao m_icao; diff --git a/src/blackmisc/avairporticao.cpp b/src/blackmisc/avairporticao.cpp index a7d7958d4..5114aee1a 100644 --- a/src/blackmisc/avairporticao.cpp +++ b/src/blackmisc/avairporticao.cpp @@ -21,55 +21,6 @@ namespace BlackMisc return other == (*this); } - /* - * Compare - */ - int CAirportIcao::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAirportIcao::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAirportIcao::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * To JSON - */ - QJsonObject CAirportIcao::toJson() const - { - return BlackMisc::serializeJson(CAirportIcao::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - void CAirportIcao::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAirportIcao::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CAirportIcao::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * Unify ICAO code */ @@ -90,65 +41,5 @@ namespace BlackMisc return icao.length() == 4; } - /* - * Equal? - */ - bool CAirportIcao::operator ==(const CAirportIcao &other) const - { - if (this == &other) return true; - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - - /* - * Unequal? - */ - bool CAirportIcao::operator !=(const CAirportIcao &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CAirportIcao::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Less than? - */ - bool CAirportIcao::operator <(const CAirportIcao &other) const - { - return this->m_icaoCode < other.m_icaoCode; - } - - /* - * metaTypeId - */ - int CAirportIcao::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAirportIcao::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CAirportIcao::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - } // namespace } // namespace diff --git a/src/blackmisc/avairporticao.h b/src/blackmisc/avairporticao.h index c2b19db68..0a63533e7 100644 --- a/src/blackmisc/avairporticao.h +++ b/src/blackmisc/avairporticao.h @@ -20,7 +20,7 @@ namespace BlackMisc namespace Aviation { //! Value object encapsulating information of a callsign. - class CAirportIcao : public BlackMisc::CValueObject + class CAirportIcao : public CValueObjectStdTuple { 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; diff --git a/src/blackmisc/avatcstation.cpp b/src/blackmisc/avatcstation.cpp index 2d401d56f..588a637e8 100644 --- a/src/blackmisc/avatcstation.cpp +++ b/src/blackmisc/avatcstation.cpp @@ -161,89 +161,6 @@ namespace BlackMisc (void)QT_TRANSLATE_NOOP("Network", "voiceroom"); } - /* - * Register metadata - */ - void CAtcStation::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CAtcStation::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CAtcStation::toJson() const - { - return BlackMisc::serializeJson(CAtcStation::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CAtcStation::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAtcStation::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Compare - */ - int CAtcStation::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAtcStation::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAtcStation::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CAtcStation::operator ==(const CAtcStation &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Hash - */ - uint CAtcStation::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Unequal? - */ - bool CAtcStation::operator !=(const CAtcStation &other) const - { - return !((*this) == other); - } - /* * Frequency */ @@ -407,22 +324,5 @@ namespace BlackMisc } } - /* - * metaTypeId - */ - int CAtcStation::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAtcStation::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - } // namespace } // namespace diff --git a/src/blackmisc/avatcstation.h b/src/blackmisc/avatcstation.h index 777bd3694..a5b2f2bdc 100644 --- a/src/blackmisc/avatcstation.h +++ b/src/blackmisc/avatcstation.h @@ -32,7 +32,7 @@ namespace BlackMisc /*! * Value object encapsulating information about an ATC station. */ - class CAtcStation : public BlackMisc::CValueObject, public BlackMisc::Geo::ICoordinateGeodetic + class CAtcStation : public CValueObjectStdTuple, public Geo::ICoordinateGeodetic { public: //! Properties by index @@ -67,21 +67,9 @@ namespace BlackMisc bool isOnline = false, const QDateTime &bookedFromUtc = QDateTime(), const QDateTime &bookedUntilUtc = QDateTime(), const CInformationMessage &atis = CInformationMessage(CInformationMessage::ATIS), const CInformationMessage &metar = CInformationMessage(CInformationMessage::METAR)); - //! \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); } - //! \copydoc CValueObject::toIcon() virtual BlackMisc::CIcon toIcon() const override { return this->m_callsign.toIcon(); } - //! Equal operator == - bool operator ==(const CAtcStation &other) const; - - //! Unequal operator != - bool operator !=(const CAtcStation &other) const; - //! Has booking times? bool hasBookingTimes() const { @@ -266,46 +254,16 @@ namespace BlackMisc return this->getPosition().longitude(); } - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const 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 CPropertyIndex &index) override; - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CAtcStation) CCallsign m_callsign; diff --git a/src/blackmisc/avcallsign.cpp b/src/blackmisc/avcallsign.cpp index c36962165..6150f0aab 100644 --- a/src/blackmisc/avcallsign.cpp +++ b/src/blackmisc/avcallsign.cpp @@ -79,47 +79,6 @@ namespace BlackMisc return other == (*this); } - /* - * Compare - */ - int CCallsign::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - /* - * Marshall to DBus - */ - void CCallsign::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CCallsign::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * To JSON - */ - QJsonObject CCallsign::toJson() const - { - return BlackMisc::serializeJson(CCallsign::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From JSON - */ - void CCallsign::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CCallsign::jsonMembers(), TupleConverter::toTuple(*this)); - } - /* * Index */ @@ -167,73 +126,5 @@ namespace BlackMisc } } - /* - * Members - */ - const QStringList &CCallsign::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * Equal? - */ - bool CCallsign::operator ==(const CCallsign &other) const - { - if (this == &other) return true; - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - - /* - * Unequal? - */ - bool CCallsign::operator !=(const CCallsign &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CCallsign::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Less than? - */ - bool CCallsign::operator <(const CCallsign &other) const - { - return this->m_callsign < other.m_callsign; - } - - /* - * metaTypeId - */ - int CCallsign::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CCallsign::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CCallsign::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - } // namespace } // namespace diff --git a/src/blackmisc/avcallsign.h b/src/blackmisc/avcallsign.h index 2d6ccd50a..033234349 100644 --- a/src/blackmisc/avcallsign.h +++ b/src/blackmisc/avcallsign.h @@ -21,7 +21,7 @@ namespace BlackMisc namespace Aviation { //! Value object encapsulating information of a callsign. - class CCallsign : public BlackMisc::CValueObject + class CCallsign : public CValueObjectStdTuple { public: //! Indexes @@ -66,30 +66,6 @@ namespace BlackMisc //! Equals callsign string? bool equalsString(const QString &callsignString) const; - //! Equal operator == - bool operator ==(const CCallsign &other) const; - - //! Unequal operator != - bool operator !=(const CCallsign &other) const; - - //! Less than operator < for sorting - bool operator <(const CCallsign &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; - - //! \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); } - //! \copydoc CValueObject::toIcon() virtual BlackMisc::CIcon toIcon() const override { return CCallsign::convertToIcon(*this); } @@ -99,31 +75,10 @@ namespace BlackMisc //! \copydoc CValueObject::setPropertyByIndex(variant, index) virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override; - //! Register metadata - static void registerMetadata(); - - //! Members - static const QStringList &jsonMembers(); - protected: //! \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; - //! Unify the callsign static QString unifyCallsign(const QString &callsign); diff --git a/src/blackmisc/avflightplan.cpp b/src/blackmisc/avflightplan.cpp index 91e525643..5b0f2c495 100644 --- a/src/blackmisc/avflightplan.cpp +++ b/src/blackmisc/avflightplan.cpp @@ -15,21 +15,6 @@ namespace BlackMisc namespace Aviation { - bool CFlightPlan::operator ==(const CFlightPlan &other) const - { - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - bool CFlightPlan::operator !=(const CFlightPlan &other) const - { - return !(*this == other); - } - - uint CFlightPlan::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - QString CFlightPlan::convertToQString(bool i18n) const { QString s; @@ -55,60 +40,10 @@ namespace BlackMisc return s; } - int CFlightPlan::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CFlightPlan::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return CValueObject::isA(metaTypeId); - } - - int CFlightPlan::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - void CFlightPlan::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - void CFlightPlan::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - const QStringList &CFlightPlan::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - QJsonObject CFlightPlan::toJson() const - { - return BlackMisc::serializeJson(CFlightPlan::jsonMembers(), TupleConverter::toTuple(*this)); - } - - void CFlightPlan::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CFlightPlan::jsonMembers(), TupleConverter::toTuple(*this)); - } - BlackMisc::CIcon CFlightPlan::toIcon() const { return BlackMisc::CIconList::iconForIndex(CIcons::StandardIconAppFlightPlan16); } - void CFlightPlan::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - } // namespace } // namespace diff --git a/src/blackmisc/avflightplan.h b/src/blackmisc/avflightplan.h index 2cd93b49f..653fa2a46 100644 --- a/src/blackmisc/avflightplan.h +++ b/src/blackmisc/avflightplan.h @@ -26,7 +26,7 @@ namespace BlackMisc /*! * Value object for a flight plan */ - class CFlightPlan : public BlackMisc::CValueObject + class CFlightPlan : public CValueObjectStdTuple { public: /*! @@ -181,55 +181,13 @@ namespace BlackMisc //! Get remarks string const QString &getRemarks() const { return m_remarks; } - //! Equals operator - bool operator ==(const CFlightPlan &other) const; - - //! Not equals operator - bool operator !=(const CFlightPlan &other) const; - - //! \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); } - - //! \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; - //! \copydoc CValueObject::toIcon virtual CIcon toIcon() const override; - //! Register metadata - static void registerMetadata(); - - //! Members - static const QStringList &jsonMembers(); - protected: //! \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::marshallFromDbus() - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - private: BLACK_ENABLE_TUPLE_CONVERSION(CFlightPlan) QString m_equipmentIcao; diff --git a/src/blackmisc/avinformationmessage.cpp b/src/blackmisc/avinformationmessage.cpp index 59dcaf6dc..82ca028b2 100644 --- a/src/blackmisc/avinformationmessage.cpp +++ b/src/blackmisc/avinformationmessage.cpp @@ -22,110 +22,6 @@ namespace BlackMisc return this->m_message; } - /* - * metaTypeId - */ - int CInformationMessage::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CInformationMessage::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CInformationMessage::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CInformationMessage::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CInformationMessage::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CInformationMessage::operator ==(const CInformationMessage &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CInformationMessage::operator !=(const CInformationMessage &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CInformationMessage::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Register metadata - */ - void CInformationMessage::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * JSON members - */ - const QStringList &CInformationMessage::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CInformationMessage::toJson() const - { - return BlackMisc::serializeJson(CInformationMessage::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - void CInformationMessage::convertFromJson(const QJsonObject &json) - { - this->m_message = json.value("m_message").toString(); - this->m_type = static_cast(qRound(json.value("m_type").toDouble())); - this->m_receivedTimestamp = QDateTime::fromString(json.value("m_receivedTimestamp").toString()); - } - /* * Type as string */ diff --git a/src/blackmisc/avinformationmessage.h b/src/blackmisc/avinformationmessage.h index 39f42eef3..1270b6378 100644 --- a/src/blackmisc/avinformationmessage.h +++ b/src/blackmisc/avinformationmessage.h @@ -25,7 +25,7 @@ namespace BlackMisc * Value object encapsulating information message. * ATIS, METAR, TAF */ - class CInformationMessage : public BlackMisc::CValueObject + class CInformationMessage : public CValueObjectStdTuple { public: /*! @@ -53,18 +53,6 @@ namespace BlackMisc : m_type(type), m_message(message) {} - //! \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); } - - //! Equal operator == - bool operator ==(const CInformationMessage &other) const; - - //! operator != - bool operator !=(const CInformationMessage &other) const; - //! Get message. const QString &getMessage() const { return m_message; } @@ -106,40 +94,10 @@ namespace BlackMisc //! Is empty? bool isEmpty() const { return this->m_message.isEmpty(); } - //! \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(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CInformationMessage) InformationType m_type; diff --git a/src/blackmisc/avselcal.cpp b/src/blackmisc/avselcal.cpp index 0d4551b09..2306cfca6 100644 --- a/src/blackmisc/avselcal.cpp +++ b/src/blackmisc/avselcal.cpp @@ -137,104 +137,5 @@ namespace BlackMisc return CSelcal::allCodePairs; } - /* - * Compare - */ - int CSelcal::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CSelcal::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CSelcal::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CSelcal::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Equal? - */ - bool CSelcal::operator ==(const CSelcal &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CSelcal::operator !=(const CSelcal &other) const - { - return !((*this) == other); - } - - /* - * metaTypeId - */ - int CSelcal::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CSelcal::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CSelcal::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CSelcal::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CSelcal::toJson() const - { - return BlackMisc::serializeJson(CSelcal::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CSelcal::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CSelcal::jsonMembers(), TupleConverter::toTuple(*this)); - } } // namespace } // namespace diff --git a/src/blackmisc/avselcal.h b/src/blackmisc/avselcal.h index f869ed2a7..3cb12ce64 100644 --- a/src/blackmisc/avselcal.h +++ b/src/blackmisc/avselcal.h @@ -24,7 +24,7 @@ namespace BlackMisc * \see http://en.wikipedia.org/wiki/SELCAL * \see http://www.asri.aero/our-services/selcal/ User Guide */ - class CSelcal : public BlackMisc::CValueObject + class CSelcal : public CValueObjectStdTuple { public: //! Default constructor. @@ -39,12 +39,6 @@ namespace BlackMisc */ CSelcal(const char *code) : m_code(code) {} - //! \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 valid? bool isValid() const { return CSelcal::isValidCode(this->m_code); } @@ -57,27 +51,6 @@ namespace BlackMisc */ QList getFrequencies() const; - //! Equal operator == - bool operator ==(const CSelcal &other) const; - - //! Unequal operator != - bool operator !=(const CSelcal &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(); - - //! JSON member names - static const QStringList &jsonMembers(); - //! Equals given string bool equalsString(const QString &code) const; @@ -100,21 +73,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(CSelcal) QString m_code; diff --git a/src/blackmisc/eveventhotkeyfunction.cpp b/src/blackmisc/eveventhotkeyfunction.cpp index d97edf63d..1fea6a8b9 100644 --- a/src/blackmisc/eveventhotkeyfunction.cpp +++ b/src/blackmisc/eveventhotkeyfunction.cpp @@ -18,19 +18,6 @@ namespace BlackMisc { } - // Hash - uint CEventHotkeyFunction::getValueHash() const - { - return qHash(TupleConverter::toMetaTuple(*this)); - } - - // Register metadata - void CEventHotkeyFunction::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - /* * Convert to string */ @@ -41,48 +28,5 @@ namespace BlackMisc s.append(" ").append(m_hotkeyFunc.toQString(i18n)); return s; } - - /* - * metaTypeId - */ - int CEventHotkeyFunction::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CEventHotkeyFunction::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CEventHotkeyFunction::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - /* - * Marshall to DBus - */ - void CEventHotkeyFunction::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toMetaTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CEventHotkeyFunction::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toMetaTuple(*this); - } } } diff --git a/src/blackmisc/eveventhotkeyfunction.h b/src/blackmisc/eveventhotkeyfunction.h index 5d6e8c9ef..b4c1e32be 100644 --- a/src/blackmisc/eveventhotkeyfunction.h +++ b/src/blackmisc/eveventhotkeyfunction.h @@ -22,7 +22,7 @@ namespace BlackMisc namespace Event { //! Value object encapsulating a hotkey function for distribution - class CEventHotkeyFunction : public BlackMisc::CValueObject + class CEventHotkeyFunction : public CValueObjectStdTuple { public: //! Default constructor. @@ -31,18 +31,6 @@ namespace BlackMisc //! Constructor. CEventHotkeyFunction(CHotkeyFunction func, bool argument); - //! \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); } - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! Register metadata - static void registerMetadata(); - //! Get the event originator const COriginator &getEventOriginator() const {return m_eventOriginator;} @@ -56,21 +44,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(CEventHotkeyFunction) COriginator m_eventOriginator; diff --git a/src/blackmisc/hotkeyfunction.cpp b/src/blackmisc/hotkeyfunction.cpp index 0fa06b26d..d25c51739 100644 --- a/src/blackmisc/hotkeyfunction.cpp +++ b/src/blackmisc/hotkeyfunction.cpp @@ -39,68 +39,8 @@ namespace BlackMisc } } - // Hash - uint CHotkeyFunction::getValueHash() const - { - return qHash(TupleConverter::toMetaTuple(*this)); - } - - // To JSON - QJsonObject CHotkeyFunction::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - // From Json - void CHotkeyFunction::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - void CHotkeyFunction::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - // Equal? - bool CHotkeyFunction::operator ==(const CHotkeyFunction &other) const - { - if (this == &other) return true; - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - QString CHotkeyFunction::convertToQString(bool /* i18n */) const { return getFunctionAsString(); } - - int CHotkeyFunction::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CHotkeyFunction::isA(int metaTypeId) const - { - return (metaTypeId == qMetaTypeId()); - } - - // Compare - int CHotkeyFunction::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - // Marshall to DBus - void CHotkeyFunction::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toMetaTuple(*this); - } - - // Unmarshall from DBus - void CHotkeyFunction::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toMetaTuple(*this); - } } diff --git a/src/blackmisc/hotkeyfunction.h b/src/blackmisc/hotkeyfunction.h index d494d5e2c..002dbe9e0 100644 --- a/src/blackmisc/hotkeyfunction.h +++ b/src/blackmisc/hotkeyfunction.h @@ -18,7 +18,7 @@ namespace BlackMisc { //! Value object representing a hotkey function. - class CHotkeyFunction : public CValueObject + class CHotkeyFunction : public CValueObjectStdTuple { public: //! Function type @@ -48,27 +48,6 @@ namespace BlackMisc //! Set function void setFunction(const Function &function) { m_function = function; } - //! \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); } - - //! \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(); - - //! Equal? - bool operator ==(const CHotkeyFunction &other) const; - //! Hotkey function is Ptt static const CHotkeyFunction &Ptt() { @@ -112,25 +91,9 @@ namespace BlackMisc } protected: - //! \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(otherBase) - virtual int compareImpl(const CValueObject &otherBase) 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(CHotkeyFunction) Function m_function; diff --git a/src/blackmisc/hwjoystickbutton.cpp b/src/blackmisc/hwjoystickbutton.cpp index 091441918..6e4b9b31b 100644 --- a/src/blackmisc/hwjoystickbutton.cpp +++ b/src/blackmisc/hwjoystickbutton.cpp @@ -19,33 +19,6 @@ namespace BlackMisc m_buttonIndex(buttonIndex) {} - /* - * Hash - */ - uint CJoystickButton::getValueHash() const - { - return qHash(TupleConverter::toMetaTuple(*this)); - } - - // To JSON - QJsonObject CJoystickButton::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - // From Json - void CJoystickButton::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - // Meta data - void CJoystickButton::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - void CJoystickButton::setButtonIndex(qint32 buttonIndex) { m_buttonIndex = buttonIndex; @@ -114,69 +87,12 @@ namespace BlackMisc return name.toInt(); } - /* - * Equal? - */ - bool CJoystickButton::operator ==(const CJoystickButton &other) const - { - if (this == &other) return true; - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - - /* - * Unequal? - */ - bool CJoystickButton::operator !=(const CJoystickButton &other) const - { - return !((*this) == other); - } - - bool CJoystickButton::operator< (CJoystickButton const &other) const - { - return TupleConverter::toMetaTuple(*this) < TupleConverter::toMetaTuple(other); - } - QString CJoystickButton::convertToQString(bool /* i18n */) const { QString s = getButtonAsString(); return s.trimmed(); } - int CJoystickButton::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CJoystickButton::isA(int metaTypeId) const - { - return (metaTypeId == qMetaTypeId()); - } - - /* - * Compare - */ - int CJoystickButton::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - /* - * Marshall to DBus - */ - void CJoystickButton::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toMetaTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CJoystickButton::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toMetaTuple(*this); - } - } // namespace Hardware } // BlackMisc diff --git a/src/blackmisc/hwjoystickbutton.h b/src/blackmisc/hwjoystickbutton.h index fc601907f..abf6ec6a2 100644 --- a/src/blackmisc/hwjoystickbutton.h +++ b/src/blackmisc/hwjoystickbutton.h @@ -21,7 +21,7 @@ namespace BlackMisc namespace Hardware { //! Value object representing a joystick button - class CJoystickButton : public CValueObject + class CJoystickButton : public CValueObjectStdTuple { public: //! Properties by index @@ -38,27 +38,6 @@ namespace BlackMisc //! Constructor CJoystickButton(qint32 buttonIndex); - //! \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); } - - //! \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(); - //! Get button index qint32 getButtonIndex() const { return m_buttonIndex; } @@ -89,34 +68,10 @@ namespace BlackMisc //! Invalid button index static qint32 getInvalidIndex() { return m_invalidIndex; } - //! Equal? - bool operator ==(const CJoystickButton &other) const; - - //! Unequal operator != - bool operator !=(const CJoystickButton &other) const; - - //! < - bool operator<(CJoystickButton const &other) const; - protected: //! \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(otherBase) - virtual int compareImpl(const CValueObject &otherBase) 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(CJoystickButton) qint32 m_buttonIndex = m_invalidIndex; //!< code similar to Qt::Key diff --git a/src/blackmisc/hwkeyboardkey.cpp b/src/blackmisc/hwkeyboardkey.cpp index c5a75b097..c7fc5f21b 100644 --- a/src/blackmisc/hwkeyboardkey.cpp +++ b/src/blackmisc/hwkeyboardkey.cpp @@ -24,22 +24,6 @@ namespace BlackMisc m_qtKey(keyCode), m_modifier1(modifier1), m_modifier2(modifier2) {} - void CKeyboardKey::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - QJsonObject CKeyboardKey::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - void CKeyboardKey::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - QString CKeyboardKey::convertToQString(bool /* i18n */) const { QString s = this->getModifier1AsString(); @@ -48,16 +32,6 @@ namespace BlackMisc return s.trimmed(); } - int CKeyboardKey::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CKeyboardKey::isA(int metaTypeId) const - { - return (metaTypeId == qMetaTypeId()); - } - QString CKeyboardKey::modifierToString(CKeyboardKey::Modifier modifier) { switch (modifier) @@ -132,46 +106,6 @@ namespace BlackMisc return modifiers; } - int CKeyboardKey::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - void CKeyboardKey::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toMetaTuple(*this); - } - - void CKeyboardKey::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toMetaTuple(*this); - } - - uint CKeyboardKey::getValueHash() const - { - return qHash(TupleConverter::toMetaTuple(*this)); - } - - bool CKeyboardKey::operator ==(const CKeyboardKey &other) const - { - if (this == &other) return true; - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - - bool CKeyboardKey::operator !=(const CKeyboardKey &other) const - { - return !((*this) == other); - } - - bool CKeyboardKey::operator< (CKeyboardKey const &other) const - { - if (this->getKey() < other.getKey()) - return true; - else - return false; - } - void CKeyboardKey::cleanup() { if (!this->hasModifier()) return; diff --git a/src/blackmisc/hwkeyboardkey.h b/src/blackmisc/hwkeyboardkey.h index c62dbbef6..269403339 100644 --- a/src/blackmisc/hwkeyboardkey.h +++ b/src/blackmisc/hwkeyboardkey.h @@ -22,7 +22,7 @@ namespace BlackMisc namespace Hardware { //! Value object representing a keyboard key. - class CKeyboardKey : public CValueObject + class CKeyboardKey : public CValueObjectStdTuple { public: //! Properties by index @@ -61,33 +61,6 @@ namespace BlackMisc //! Constructor CKeyboardKey(Qt::Key keyCode, Modifier modifier1 = ModifierNone, Modifier modifier2 = ModifierNone); - //! \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); } - - //! \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(); - - //! Equal? - bool operator ==(const CKeyboardKey &other) const; - - //! Unequal operator != - bool operator !=(const CKeyboardKey &other) const; - - //! < - bool operator<(CKeyboardKey const &other) const; - //! Get key code Qt::Key getKey() const { return this->m_qtKey; } @@ -233,21 +206,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(otherBase) - virtual int compareImpl(const CValueObject &otherBase) 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(CKeyboardKey) Qt::Key m_qtKey; //!< code similar to Qt::Key diff --git a/src/blackmisc/icon.cpp b/src/blackmisc/icon.cpp index 32f5a446a..506765914 100644 --- a/src/blackmisc/icon.cpp +++ b/src/blackmisc/icon.cpp @@ -12,39 +12,6 @@ namespace BlackMisc { - /* - * Compare - */ - int CIcon::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CIcon::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CIcon::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CIcon::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - /* * Pixmap */ @@ -61,57 +28,6 @@ namespace BlackMisc this->m_rotateDegrees = rotate.valueRounded(PhysicalQuantities::CAngleUnit::deg(), 0); } - /* - * Equal? - */ - bool CIcon::operator ==(const CIcon &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CIcon::operator !=(const CIcon &other) const - { - return !((*this) == other); - } - - /* - * metaTypeId - */ - int CIcon::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CIcon::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CIcon::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CIcon::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * String */ @@ -122,20 +38,4 @@ namespace BlackMisc return s; } - /* - * To JSON - */ - QJsonObject CIcon::toJson() const - { - return BlackMisc::serializeJson(CIcon::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CIcon::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CIcon::jsonMembers(), TupleConverter::toTuple(*this)); - } - } // namespace diff --git a/src/blackmisc/icon.h b/src/blackmisc/icon.h index 04c0055a8..42708680f 100644 --- a/src/blackmisc/icon.h +++ b/src/blackmisc/icon.h @@ -20,7 +20,7 @@ namespace BlackMisc /*! * Value object for icons. */ - class CIcon : public BlackMisc::CValueObject + class CIcon : public CValueObjectStdTuple { public: //! Default constructor. @@ -51,33 +51,6 @@ namespace BlackMisc //! Set descriptive text void setDescriptiveText(const QString &text) { this->m_descriptiveText = text; } - //! Equal operator == - bool operator ==(const CIcon &other) const; - - //! Unequal operator != - bool operator !=(const CIcon &other) const; - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::fromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! \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); } - - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - //! Implicit conversion operator QPixmap () const { return this->toPixmap(); } @@ -85,21 +58,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(CIcon) int m_index = static_cast(CIcons::NotSet); diff --git a/src/blackmisc/logcategory.cpp b/src/blackmisc/logcategory.cpp index b05465532..5e1c340d4 100644 --- a/src/blackmisc/logcategory.cpp +++ b/src/blackmisc/logcategory.cpp @@ -11,57 +11,9 @@ namespace BlackMisc { - void CLogCategory::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - uint CLogCategory::getValueHash() const - { - return qHash(TupleConverter::toMetaTuple(*this)); - } - - bool CLogCategory::operator ==(const CLogCategory &other) const - { - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - - bool CLogCategory::operator !=(const CLogCategory &other) const - { - return TupleConverter::toMetaTuple(*this) != TupleConverter::toMetaTuple(other); - } - QString CLogCategory::convertToQString(bool i18n) const { Q_UNUSED(i18n); return m_string; } - - int CLogCategory::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CLogCategory::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - int CLogCategory::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - void CLogCategory::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toMetaTuple(*this); - } - - void CLogCategory::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toMetaTuple(*this); - } } diff --git a/src/blackmisc/logcategory.h b/src/blackmisc/logcategory.h index 57d3e828a..386367a27 100644 --- a/src/blackmisc/logcategory.h +++ b/src/blackmisc/logcategory.h @@ -21,7 +21,7 @@ namespace BlackMisc * * A log handler can filter messages based on their categories. */ - class CLogCategory : public CValueObject + class CLogCategory : public CValueObjectStdTuple { public: //! \name Predefined special categories (public static methods) @@ -104,43 +104,10 @@ namespace BlackMisc //! Returns true if the category string contains the given substring. bool contains(const QString &substring) const { return m_string.contains(substring); } - //! Register metadata - static void registerMetadata(); - - //! \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); } - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! Equal operator - bool operator ==(const CLogCategory &other) const; - - //! Not equal operator - bool operator !=(const CLogCategory &other) const; - protected: //! \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::marshallFromDbus() - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - private: BLACK_ENABLE_TUPLE_CONVERSION(CLogCategory) QString m_string; diff --git a/src/blackmisc/namevariantpair.cpp b/src/blackmisc/namevariantpair.cpp index 8ed6ecf2d..158d240bb 100644 --- a/src/blackmisc/namevariantpair.cpp +++ b/src/blackmisc/namevariantpair.cpp @@ -47,73 +47,6 @@ namespace BlackMisc return s; } - /* - * Marshall to DBus - */ - void CNameVariantPair::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CNameVariantPair::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CNameVariantPair::operator ==(const CNameVariantPair &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CNameVariantPair::operator !=(const CNameVariantPair &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CNameVariantPair::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * metaTypeId - */ - int CNameVariantPair::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CNameVariantPair::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CNameVariantPair::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - /* * Property by index */ @@ -172,37 +105,4 @@ namespace BlackMisc } } - /* - * Register metadata - */ - void CNameVariantPair::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To JSON - */ - QJsonObject CNameVariantPair::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - /* - * From JSON - */ - void CNameVariantPair::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - /* - * Members - */ - const QStringList &CNameVariantPair::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - } // namespace diff --git a/src/blackmisc/namevariantpair.h b/src/blackmisc/namevariantpair.h index db98b30f2..22bc77d09 100644 --- a/src/blackmisc/namevariantpair.h +++ b/src/blackmisc/namevariantpair.h @@ -21,7 +21,7 @@ namespace BlackMisc /*! * Value / variant pair */ - class CNameVariantPair : public BlackMisc::CValueObject + class CNameVariantPair : public CValueObjectStdTuple { public: //! Properties by index @@ -57,58 +57,16 @@ namespace BlackMisc //! Has icon bool hasIcon() const; - //! Equal operator == - bool operator ==(const CNameVariantPair &other) const; - - //! Unequal operator != - bool operator !=(const CNameVariantPair &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(); - //! \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; - //! \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); } - protected: //! \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::marshallFromDbus() - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - private: BLACK_ENABLE_TUPLE_CONVERSION(CNameVariantPair) QString m_name; diff --git a/src/blackmisc/nwaircraftmapping.cpp b/src/blackmisc/nwaircraftmapping.cpp index f31d267ad..08e16c53b 100644 --- a/src/blackmisc/nwaircraftmapping.cpp +++ b/src/blackmisc/nwaircraftmapping.cpp @@ -34,39 +34,6 @@ namespace BlackMisc return s; } - /* - * Compare - */ - int CAircraftMapping::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAircraftMapping::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAircraftMapping::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CAircraftMapping::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - /* * Model string? */ @@ -75,73 +42,6 @@ namespace BlackMisc return this->m_model.matchesModelString(modelString, sensitivity); } - /* - * Equal? - */ - bool CAircraftMapping::operator ==(const CAircraftMapping &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CAircraftMapping::operator !=(const CAircraftMapping &other) const - { - return !((*this) == other); - } - - /* - * metaTypeId - */ - int CAircraftMapping::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAircraftMapping::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CAircraftMapping::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CAircraftMapping::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CAircraftMapping::toJson() const - { - return BlackMisc::serializeJson(CAircraftMapping::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CAircraftMapping::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAircraftMapping::jsonMembers(), TupleConverter::toTuple(*this)); - } - /* * Property by index */ diff --git a/src/blackmisc/nwaircraftmapping.h b/src/blackmisc/nwaircraftmapping.h index 1901e580f..3fb35f10e 100644 --- a/src/blackmisc/nwaircraftmapping.h +++ b/src/blackmisc/nwaircraftmapping.h @@ -23,7 +23,7 @@ namespace BlackMisc /*! * Mapping */ - class CAircraftMapping: public BlackMisc::CValueObject + class CAircraftMapping : public CValueObjectStdTuple { private: BLACK_ENABLE_TUPLE_CONVERSION(CAircraftMapping) @@ -34,21 +34,6 @@ namespace BlackMisc //! \copydoc CValueObject::convertToQString virtual QString convertToQString(bool i18n = false) const override; - //! \copydoc CValueObject::marshallToDbus - virtual void marshallToDbus(QDBusArgument &) const override; - - //! \copydoc CValueObject::unmarshallFromDbus - virtual void unmarshallFromDbus(const QDBusArgument &) override; - - //! \copydoc CValueObject::compareImpl(const CValueObject &) - int compareImpl(const CValueObject &otherBase) const override; - - //! \copydoc CValueObject::getMetaTypeId() - int getMetaTypeId() const override; - - //! \copydoc CValueObject::isA - virtual bool isA(int metaTypeId) const override; - public: //! Properties enum ColumnIndex @@ -63,12 +48,6 @@ namespace BlackMisc //! Constructor CAircraftMapping(const QString &aircraftDesignator, const QString &airlineDesignator, const QString &model); - //! operator == - bool operator ==(const CAircraftMapping &other) const; - - //! operator != - bool operator !=(const CAircraftMapping &other) const; - //! \copydoc CValueObject::propertyByIndex QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; @@ -87,32 +66,11 @@ namespace BlackMisc //! Model const BlackMisc::Network::CAircraftModel &getModel() const { return this->m_model; } - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const override; - - //! \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); } - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - //! Matches model string? bool matchesModelString(const QString &modelString, Qt::CaseSensitivity sensitivity) const; //! Matches wildcard icao object bool matchesWildcardIcao(const BlackMisc::Aviation::CAircraftIcao &otherIcao) const { return m_icao.matchesWildcardIcao(otherIcao); } - - //! Register the metatypes - static void registerMetadata(); - - //! Members - static const QStringList &jsonMembers(); }; } } diff --git a/src/blackmisc/nwaircraftmodel.cpp b/src/blackmisc/nwaircraftmodel.cpp index a1f6c6e27..131d72e93 100644 --- a/src/blackmisc/nwaircraftmodel.cpp +++ b/src/blackmisc/nwaircraftmodel.cpp @@ -25,106 +25,6 @@ namespace BlackMisc return s; } - /* - * Compare - */ - int CAircraftModel::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CAircraftModel::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAircraftModel::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CAircraftModel::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Equal? - */ - bool CAircraftModel::operator ==(const CAircraftModel &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CAircraftModel::operator !=(const CAircraftModel &other) const - { - return !((*this) == other); - } - - /* - * metaTypeId - */ - int CAircraftModel::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CAircraftModel::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CAircraftModel::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CAircraftModel::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CAircraftModel::toJson() const - { - return BlackMisc::serializeJson(CAircraftModel::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CAircraftModel::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAircraftModel::jsonMembers(), TupleConverter::toTuple(*this)); - } - /* * Property by index */ diff --git a/src/blackmisc/nwaircraftmodel.h b/src/blackmisc/nwaircraftmodel.h index 03bf554a9..66170be9b 100644 --- a/src/blackmisc/nwaircraftmodel.h +++ b/src/blackmisc/nwaircraftmodel.h @@ -22,7 +22,7 @@ namespace BlackMisc /*! * Another pilot's aircraft model */ - class CAircraftModel : public BlackMisc::CValueObject + class CAircraftModel : public CValueObjectStdTuple { public: //! Indexes @@ -38,27 +38,6 @@ namespace BlackMisc //! Constructor. CAircraftModel(const QString &model, bool isQueriedString) : m_modelString(model), m_queriedModelStringFlag(isQueriedString) {} - //! Equal operator == - bool operator ==(const CAircraftModel &other) const; - - //! Unequal operator != - bool operator !=(const CAircraftModel &other) const; - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! \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); } - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - //! \copydoc CValueObject::propertyByIndex(int) virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; @@ -80,31 +59,10 @@ namespace BlackMisc //! Matches model string? bool matchesModelString(const QString &modelString, Qt::CaseSensitivity sensitivity) const; - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CAircraftModel) QString m_modelString; diff --git a/src/blackmisc/nwclient.cpp b/src/blackmisc/nwclient.cpp index 71b347997..4e063da5b 100644 --- a/src/blackmisc/nwclient.cpp +++ b/src/blackmisc/nwclient.cpp @@ -32,106 +32,6 @@ namespace BlackMisc return s; } - /* - * Compare - */ - int CClient::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CClient::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CClient::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CClient::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Equal? - */ - bool CClient::operator ==(const CClient &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CClient::operator !=(const CClient &other) const - { - return !((*this) == other); - } - - /* - * metaTypeId - */ - int CClient::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CClient::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Register metadata - */ - void CClient::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CClient::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CClient::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - /* - * From Json - */ - void CClient::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - /* * Capability */ diff --git a/src/blackmisc/nwclient.h b/src/blackmisc/nwclient.h index 25179cd80..dc56bccd3 100644 --- a/src/blackmisc/nwclient.h +++ b/src/blackmisc/nwclient.h @@ -25,7 +25,7 @@ namespace BlackMisc /*! * Another client software. */ - class CClient : public BlackMisc::CValueObject + class CClient : public CValueObjectStdTuple { public: //! Properties by index @@ -60,27 +60,6 @@ namespace BlackMisc //! Constructor. CClient(const CUser &user) : m_user(user) {} - //! Equal operator == - bool operator ==(const CClient &other) const; - - //! Unequal operator != - bool operator !=(const CClient &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; - - //! \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); } - //! Callsign used with other client const BlackMisc::Aviation::CCallsign &getCallsign() const { return this->m_user.getCallsign(); } @@ -138,31 +117,10 @@ namespace BlackMisc //! \copydoc CValueObject::setPropertyByIndex(const QVariant, int) virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override; - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CClient) CUser m_user; diff --git a/src/blackmisc/nwserver.cpp b/src/blackmisc/nwserver.cpp index 4c467da83..ef5f45a0c 100644 --- a/src/blackmisc/nwserver.cpp +++ b/src/blackmisc/nwserver.cpp @@ -30,48 +30,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CServer::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CServer::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CServer::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CServer::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CServer::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - /* * Valid for login */ @@ -80,31 +38,6 @@ namespace BlackMisc return this->m_user.hasValidCredentials() && this->m_port > 0 && !this->m_address.isEmpty() && this->isAcceptingConnections(); } - /* - * Equal? - */ - bool CServer::operator ==(const CServer &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CServer::operator !=(const CServer &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CServer::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - /* * Property by index */ @@ -173,38 +106,5 @@ namespace BlackMisc } } - /* - * Register metadata - */ - void CServer::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Members - */ - const QStringList &CServer::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * To JSON - */ - QJsonObject CServer::toJson() const - { - return BlackMisc::serializeJson(CServer::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From Json - */ - void CServer::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CServer::jsonMembers(), TupleConverter::toTuple(*this)); - } - } // namespace } // namespace diff --git a/src/blackmisc/nwserver.h b/src/blackmisc/nwserver.h index 6ee640b47..349dd24e7 100644 --- a/src/blackmisc/nwserver.h +++ b/src/blackmisc/nwserver.h @@ -21,7 +21,7 @@ namespace BlackMisc /*! * Value object encapsulating information of a server */ - class CServer : public BlackMisc::CValueObject + class CServer : public CValueObjectStdTuple { public: //! Properties by index @@ -81,58 +81,16 @@ namespace BlackMisc //! Is valid for login? bool isValidForLogin() const; - //! Equal operator == - bool operator ==(const CServer &other) const; - - //! Unequal operator != - bool operator !=(const CServer &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; - - //! \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); } - //! \copydoc CValueObject::propertyByIndex(int) virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; //! \copydoc CValueObject::setPropertyByIndex(const QVariant &, int index) virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override; - //! JSON member names - static const QStringList &jsonMembers(); - - //! Register metadata - static void registerMetadata(); - protected: //! \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(CServer) QString m_name; diff --git a/src/blackmisc/nwtextmessage.cpp b/src/blackmisc/nwtextmessage.cpp index 94539498b..16ba1e724 100644 --- a/src/blackmisc/nwtextmessage.cpp +++ b/src/blackmisc/nwtextmessage.cpp @@ -38,24 +38,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CTextMessage::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CTextMessage::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return this->CValueObject::isA(metaTypeId); - } - /* * Private message? */ @@ -207,64 +189,5 @@ namespace BlackMisc return candidate.right(4); } - /* - * Compare - */ - int CTextMessage::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CTextMessage::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CTextMessage::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CTextMessage::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Equal? - */ - bool CTextMessage::operator ==(const CTextMessage &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CTextMessage::operator !=(const CTextMessage &other) const - { - return !((*this) == other); - } - - /* - * Register metadata - */ - void CTextMessage::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - } // namespace } // namespace diff --git a/src/blackmisc/nwtextmessage.h b/src/blackmisc/nwtextmessage.h index e2545b5c5..4ed914115 100644 --- a/src/blackmisc/nwtextmessage.h +++ b/src/blackmisc/nwtextmessage.h @@ -25,7 +25,7 @@ namespace BlackMisc /*! * Value object encapsulating information of a text message */ - class CTextMessage : public BlackMisc::CValueObject + class CTextMessage : public CValueObjectStdTuple { public: //! \brief Default constructor. @@ -158,43 +158,10 @@ namespace BlackMisc //! \brief Get SELCAL code (if applicable, e.g. ABCD), otherwise "" QString getSelcalCode() const; - //! \brief Equal operator == - bool operator ==(const CTextMessage &other) const; - - //! \brief Unequal operator != - bool operator !=(const CTextMessage &other) const; - - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const override; - - //! \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); } - - //! \brief Register metadata - static void registerMetadata(); - protected: //! \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::unmarshallFomDbus - virtual void unmarshallFromDbus(const QDBusArgument &argument) override; - private: BLACK_ENABLE_TUPLE_CONVERSION(CTextMessage) QString m_message; diff --git a/src/blackmisc/nwuser.cpp b/src/blackmisc/nwuser.cpp index 18b23841a..11eb95b1e 100644 --- a/src/blackmisc/nwuser.cpp +++ b/src/blackmisc/nwuser.cpp @@ -35,65 +35,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CUser::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CUser::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CUser::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CUser::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CUser::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CUser::operator ==(const CUser &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CUser::operator !=(const CUser &other) const - { - return !((*this) == other); - } - /* * Exchange data */ @@ -122,47 +63,6 @@ namespace BlackMisc this->setCallsign(otherUser.getCallsign()); } - /* - * Hash - */ - uint CUser::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - QJsonObject CUser::toJson() const - { - return BlackMisc::serializeJson(CUser::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From JSON - */ - void CUser::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CUser::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CUser::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - /* - * Register metadata - */ - void CUser::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - /* * Property by index */ diff --git a/src/blackmisc/nwuser.h b/src/blackmisc/nwuser.h index 27d7d9f91..08f044491 100644 --- a/src/blackmisc/nwuser.h +++ b/src/blackmisc/nwuser.h @@ -25,7 +25,7 @@ namespace BlackMisc /*! * Value object encapsulating information of a user. */ - class CUser : public BlackMisc::CValueObject + class CUser : public CValueObjectStdTuple { public: /*! @@ -110,30 +110,9 @@ namespace BlackMisc //! Set associated callsign void setCallsign(const BlackMisc::Aviation::CCallsign &callsign) { m_callsign = callsign; } - //! Equal operator == - bool operator ==(const CUser &other) const; - - //! Unequal operator != - bool operator !=(const CUser &other) const; - - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const override; - - //! \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); } - //! \copydoc CValueObject::toIcon() virtual BlackMisc::CIcon toIcon() const override { return this->getCallsign().toIcon(); } - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - //! \copydoc CValueObject::propertyByIndex(int) virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; @@ -146,31 +125,10 @@ namespace BlackMisc */ void syncronizeData(CUser &otherUser); - //! Register metadata - static void registerMetadata(); - - //! Members - static const QStringList &jsonMembers(); - protected: //! \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(CUser) QString m_id; diff --git a/src/blackmisc/nwvoicecapabilites.cpp b/src/blackmisc/nwvoicecapabilites.cpp index c1f9b3115..bfa58535b 100644 --- a/src/blackmisc/nwvoicecapabilites.cpp +++ b/src/blackmisc/nwvoicecapabilites.cpp @@ -92,48 +92,6 @@ namespace BlackMisc this->setCapabilities(Unknown); } - /* - * metaTypeId - */ - int CVoiceCapabilities::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CVoiceCapabilities::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CVoiceCapabilities::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CVoiceCapabilities::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CVoiceCapabilities::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - /* * Icon */ @@ -156,55 +114,6 @@ namespace BlackMisc return CIconList::iconForIndex(CIcons::NetworkCapabilityUnknown); // never reached } - /* - * Equal? - */ - bool CVoiceCapabilities::operator ==(const CVoiceCapabilities &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CVoiceCapabilities::operator !=(const CVoiceCapabilities &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CVoiceCapabilities::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - QJsonObject CVoiceCapabilities::toJson() const - { - return BlackMisc::serializeJson(CVoiceCapabilities::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - void CVoiceCapabilities::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CVoiceCapabilities::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CVoiceCapabilities::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * From enum */ @@ -238,14 +147,5 @@ namespace BlackMisc return all; } - /* - * Register metadata - */ - void CVoiceCapabilities::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - } // namespace } // namespace diff --git a/src/blackmisc/nwvoicecapabilities.h b/src/blackmisc/nwvoicecapabilities.h index b5549bbd9..ad095bb13 100644 --- a/src/blackmisc/nwvoicecapabilities.h +++ b/src/blackmisc/nwvoicecapabilities.h @@ -22,7 +22,7 @@ namespace BlackMisc /*! * Value object encapsulating information for voice capabilities. */ - class CVoiceCapabilities : public BlackMisc::CValueObject + class CVoiceCapabilities : public CValueObjectStdTuple { public: //! Voice capabilities @@ -55,33 +55,6 @@ namespace BlackMisc //! \copydoc CValueObject::toIcon() virtual CIcon toIcon() const override; - //! Equal operator == - bool operator ==(const CVoiceCapabilities &other) const; - - //! Unequal operator != - bool operator !=(const CVoiceCapabilities &other) const; - - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const override; - - //! \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); } - - //! \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(); - //! From enum static const CVoiceCapabilities &fromVoiceCapabilities(VoiceCapabilities capabilities); @@ -98,21 +71,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(CVoiceCapabilities) int m_voiceCapabilities = Unknown; diff --git a/src/blackmisc/propertyindex.cpp b/src/blackmisc/propertyindex.cpp index f348fa74b..8b89ebb6d 100644 --- a/src/blackmisc/propertyindex.cpp +++ b/src/blackmisc/propertyindex.cpp @@ -75,15 +75,6 @@ namespace BlackMisc return this->m_indexes.size() > 1; } - /* - * Register metadata - */ - void CPropertyIndex::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - /* * Convert to string */ @@ -93,49 +84,6 @@ namespace BlackMisc return this->m_indexString; } - /* - * metaTypeId - */ - int CPropertyIndex::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CPropertyIndex::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CPropertyIndex::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CPropertyIndex::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CPropertyIndex::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - this->stringToList(); - } - /* * Parse from string */ @@ -179,54 +127,4 @@ namespace BlackMisc } } - /* - * Equal? - */ - bool CPropertyIndex::operator ==(const CPropertyIndex &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CPropertyIndex::operator !=(const CPropertyIndex &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CPropertyIndex::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - QJsonObject CPropertyIndex::toJson() const - { - return BlackMisc::serializeJson(CPropertyIndex::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From JSON - */ - void CPropertyIndex::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CPropertyIndex::jsonMembers(), TupleConverter::toTuple(*this)); - this->stringToList(); - } - - /* - * Members - */ - const QStringList &CPropertyIndex::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - } // namespace diff --git a/src/blackmisc/propertyindex.h b/src/blackmisc/propertyindex.h index b4c195b78..dc11b1781 100644 --- a/src/blackmisc/propertyindex.h +++ b/src/blackmisc/propertyindex.h @@ -23,7 +23,7 @@ namespace BlackMisc * Property index. The index can be nested, that's why it is a sequence * (e.g. PropertyIndexPilot, PropertyIndexRealname). */ - class CPropertyIndex : public CValueObject + class CPropertyIndex : public CValueObjectStdTuple { // In the first trial I have used CSequence as base class // This has created too much circular dependencies of the headers @@ -93,52 +93,10 @@ namespace BlackMisc return static_cast(f); } - //! Equal operator == - bool operator ==(const CPropertyIndex &other) const; - - //! Unequal operator != - bool operator !=(const CPropertyIndex &other) const; - - //! \copydoc CValueObject::CPropertyIndexlueHash() - virtual uint getValueHash() const override; - - //! \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); } - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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; - //! \copydoc CValueObject::parseFromString virtual void parseFromString(const QString &indexes) override; diff --git a/src/blackmisc/setaudio.cpp b/src/blackmisc/setaudio.cpp index 6e63eb1db..8612568e4 100644 --- a/src/blackmisc/setaudio.cpp +++ b/src/blackmisc/setaudio.cpp @@ -36,97 +36,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CSettingsAudio::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CSettingsAudio::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CSettingsAudio::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall - */ - void CSettingsAudio::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall - */ - void CSettingsAudio::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CSettingsAudio::operator ==(const CSettingsAudio &other) const - { - if (this == &other) return true; - return compare(*this, other) == 0; - } - - /* - * Unequal? - */ - bool CSettingsAudio::operator !=(const CSettingsAudio &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CSettingsAudio::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - QJsonObject CSettingsAudio::toJson() const - { - return BlackMisc::serializeJson(CSettingsAudio::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From JSON - */ - void CSettingsAudio::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CSettingsAudio::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CSettingsAudio::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * Default values */ @@ -149,15 +58,6 @@ namespace BlackMisc } } - /* - * Register metadata - */ - void CSettingsAudio::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - /* * Value */ diff --git a/src/blackmisc/setaudio.h b/src/blackmisc/setaudio.h index abf17a2e5..7879ea261 100644 --- a/src/blackmisc/setaudio.h +++ b/src/blackmisc/setaudio.h @@ -23,7 +23,7 @@ namespace BlackMisc namespace Settings { //! Value object encapsulating information of audio related settings. - class CSettingsAudio : public BlackMisc::CValueObject + class CSettingsAudio : public CValueObjectStdTuple { public: //! Default constructor. @@ -36,64 +36,22 @@ namespace BlackMisc return value; } - //! \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); } - //! Notification flag (play notification?) bool getNotificationFlag(BlackSound::CNotificationSounds::Notification notification) const; //! Notification flag (play notification?) void setNotificationFlag(BlackSound::CNotificationSounds::Notification notification, bool value); - //! Equal operator == - bool operator ==(const CSettingsAudio &other) const; - - //! Unequal operator != - bool operator !=(const CSettingsAudio &other) const; - //! \copydoc BlackCore::IContextSettings::value virtual BlackMisc::CStatusMessage value(const QString &path, const QString &command, const BlackMisc::CVariant &value, bool &changedFlag); - //! \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; - //! Init with meaningful default values void initDefaultValues(); - //! \copydoc CValueObject::registerMetadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CSettingsAudio) QString m_notificationFlags; //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..) diff --git a/src/blackmisc/setkeyboardhotkey.cpp b/src/blackmisc/setkeyboardhotkey.cpp index 3c5980d68..dd9cf56fb 100644 --- a/src/blackmisc/setkeyboardhotkey.cpp +++ b/src/blackmisc/setkeyboardhotkey.cpp @@ -23,102 +23,11 @@ namespace BlackMisc m_key(key), m_hotkeyFunction(function) {} - void CSettingKeyboardHotkey::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To JSON - */ - QJsonObject CSettingKeyboardHotkey::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - /* - * From Json - */ - void CSettingKeyboardHotkey::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - QString CSettingKeyboardHotkey::convertToQString(bool /* i18n */) const { return m_key.toQString(); } - int CSettingKeyboardHotkey::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CSettingKeyboardHotkey::isA(int metaTypeId) const - { - return (metaTypeId == qMetaTypeId()); - } - - /* - * Compare - */ - int CSettingKeyboardHotkey::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toMetaTuple(*this), TupleConverter::toMetaTuple(other)); - } - - /* - * Marshall to DBus - */ - void CSettingKeyboardHotkey::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toMetaTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CSettingKeyboardHotkey::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toMetaTuple(*this); - } - - /* - * Hash - */ - uint CSettingKeyboardHotkey::getValueHash() const - { - return qHash(TupleConverter::toMetaTuple(*this)); - } - - /* - * Equal? - */ - bool CSettingKeyboardHotkey::operator ==(const CSettingKeyboardHotkey &other) const - { - if (this == &other) return true; - return TupleConverter::toMetaTuple(*this) == TupleConverter::toMetaTuple(other); - } - - /* - * Unequal? - */ - bool CSettingKeyboardHotkey::operator !=(const CSettingKeyboardHotkey &other) const - { - return !((*this) == other); - } - - bool CSettingKeyboardHotkey::operator< (CSettingKeyboardHotkey const &other) const - { - if (this->getKey() < other.getKey()) - return true; - else - return false; - } - void CSettingKeyboardHotkey::setKey(const Hardware::CKeyboardKey &key) { m_key = key; diff --git a/src/blackmisc/setkeyboardhotkey.h b/src/blackmisc/setkeyboardhotkey.h index a5744a5ac..7de68701d 100644 --- a/src/blackmisc/setkeyboardhotkey.h +++ b/src/blackmisc/setkeyboardhotkey.h @@ -24,7 +24,7 @@ namespace BlackMisc namespace Settings { //! Value object encapsulating the keyboard hotkey assignment - class CSettingKeyboardHotkey : public CValueObject + class CSettingKeyboardHotkey : public CValueObjectStdTuple { public: //! Properties by index @@ -51,33 +51,6 @@ namespace BlackMisc //! Constructor CSettingKeyboardHotkey(const Hardware::CKeyboardKey &key, const CHotkeyFunction &function); - //! \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); } - - //! \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(); - - //! Equal? - bool operator ==(const CSettingKeyboardHotkey &other) const; - - //! Unequal operator != - bool operator !=(const CSettingKeyboardHotkey &other) const; - - //! < - bool operator<(CSettingKeyboardHotkey const &other) const; - //! Get key code const Hardware::CKeyboardKey &getKey() const { return m_key; } @@ -118,21 +91,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(otherBase) - virtual int compareImpl(const CValueObject &otherBase) 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(CSettingKeyboardHotkey) Hardware::CKeyboardKey m_key; //!< code similar to Qt::Key diff --git a/src/blackmisc/setnetwork.cpp b/src/blackmisc/setnetwork.cpp index 9b1a485cf..7aa736e4e 100644 --- a/src/blackmisc/setnetwork.cpp +++ b/src/blackmisc/setnetwork.cpp @@ -39,97 +39,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CSettingsNetwork::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CSettingsNetwork::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CSettingsNetwork::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall - */ - void CSettingsNetwork::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall - */ - void CSettingsNetwork::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CSettingsNetwork::operator ==(const CSettingsNetwork &other) const - { - if (this == &other) return true; - return compare(*this, other) == 0; - } - - /* - * Unequal? - */ - bool CSettingsNetwork::operator !=(const CSettingsNetwork &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CSettingsNetwork::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - QJsonObject CSettingsNetwork::toJson() const - { - return BlackMisc::serializeJson(CSettingsNetwork::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * From JSON - */ - void CSettingsNetwork::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CSettingsNetwork::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CSettingsNetwork::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * Default values */ @@ -145,15 +54,6 @@ namespace BlackMisc this->addTrafficNetworkServer(CServer("USA-W", "VATSIM Server", "64.151.108.52", 6809, CUser("vatsimid", "Black Client", "", "vatsimpw"))); } - /* - * Register metadata - */ - void CSettingsNetwork::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - /* * Value */ diff --git a/src/blackmisc/setnetwork.h b/src/blackmisc/setnetwork.h index ba02d96e2..4ec31ba47 100644 --- a/src/blackmisc/setnetwork.h +++ b/src/blackmisc/setnetwork.h @@ -26,7 +26,7 @@ namespace BlackMisc { //! Value object encapsulating information of network related settings. //! \remarks Not only traffic network settings, but also URLs, DBus address, ... - class CSettingsNetwork : public BlackMisc::CValueObject + class CSettingsNetwork : public CValueObjectStdTuple { public: //! Default constructor. @@ -60,12 +60,6 @@ namespace BlackMisc return value; } - //! \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); } - //! Value object, traffic network server objects BlackMisc::Network::CServerList getTrafficNetworkServers() const { return m_trafficNetworkServers; } @@ -84,52 +78,16 @@ namespace BlackMisc //! Traffic network server objects void addTrafficNetworkServer(const BlackMisc::Network::CServer &server) { m_trafficNetworkServers.push_back(server); } - //! Equal operator == - bool operator ==(const CSettingsNetwork &other) const; - - //! Unequal operator != - bool operator !=(const CSettingsNetwork &other) const; - //! \copydoc BlackCore::IContextSettings::value virtual BlackMisc::CStatusMessage value(const QString &path, const QString &command, const CVariant &value, bool &changedFlag); - //! \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; - //! Init with meaningful default values void initDefaultValues(); - //! \copydoc CValueObject::registerMetadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CSettingsNetwork) BlackMisc::Network::CServerList m_trafficNetworkServers; diff --git a/src/blackmisc/voiceroom.cpp b/src/blackmisc/voiceroom.cpp index 8bad84f84..60363a7c5 100644 --- a/src/blackmisc/voiceroom.cpp +++ b/src/blackmisc/voiceroom.cpp @@ -27,73 +27,6 @@ namespace BlackMisc this->setVoiceRoomUrl(voiceRoomUrl); } - /* - * Compare - */ - int CVoiceRoom::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall to DBus - */ - void CVoiceRoom::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CVoiceRoom::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Hash - */ - uint CVoiceRoom::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Equal? - */ - bool CVoiceRoom::operator ==(const CVoiceRoom &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Unequal? - */ - bool CVoiceRoom::operator !=(const CVoiceRoom &other) const - { - return !((*this) == other); - } - - /* - * Metadata - */ - void CVoiceRoom::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To JSON - */ - QJsonObject CVoiceRoom::toJson() const - { - return BlackMisc::serializeJson(CVoiceRoom::jsonMembers(), TupleConverter::toTuple(*this)); - } - /* * Property by index */ @@ -153,22 +86,6 @@ namespace BlackMisc } } - /* - * To JSON - */ - void CVoiceRoom::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CVoiceRoom::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CVoiceRoom::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * To string */ @@ -181,24 +98,6 @@ namespace BlackMisc return s; } - /* - * metaTypeId - */ - int CVoiceRoom::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CVoiceRoom::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - - return CValueObject::isA(metaTypeId); - } - /* * Server URL */ diff --git a/src/blackmisc/voiceroom.h b/src/blackmisc/voiceroom.h index ad02e6e91..1508c7ded 100644 --- a/src/blackmisc/voiceroom.h +++ b/src/blackmisc/voiceroom.h @@ -23,7 +23,7 @@ namespace BlackMisc /*! * Value object encapsulating information of a voice room */ - class CVoiceRoom : public BlackMisc::CValueObject + class CVoiceRoom : public CValueObjectStdTuple { public: //! Properties by index @@ -86,39 +86,12 @@ namespace BlackMisc //! Is ATIS voice channel bool isAtis() const; - //! Equal operator == - bool operator ==(const CVoiceRoom &other) const; - - //! Unequal operator != - bool operator !=(const CVoiceRoom &other) const; - - //! \copydoc CValueObject::getValueHash - virtual uint getValueHash() const override; - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - //! \copydoc CValueObject::propertyByIndex virtual QVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; //! \copydoc CValueObject::setPropertyByIndex virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override; - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! \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); } - - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - //! Protocol prefix "vvl" static const QString &protocol() { static QString p("vvl"); return p; } @@ -129,25 +102,9 @@ namespace BlackMisc static const QString &protocolComplete() { static QString p("vvl://"); return p; } protected: - //! \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(CVoiceRoom) QString m_hostname; diff --git a/src/blacksim/fscommon/aircraftcfgentries.cpp b/src/blacksim/fscommon/aircraftcfgentries.cpp index f515ce95a..b990d5536 100644 --- a/src/blacksim/fscommon/aircraftcfgentries.cpp +++ b/src/blacksim/fscommon/aircraftcfgentries.cpp @@ -27,24 +27,6 @@ namespace BlackSim // void } - /* - * Operator == - */ - bool CAircraftCfgEntries::operator ==(const CAircraftCfgEntries &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - /* - * Operator != - */ - bool CAircraftCfgEntries::operator !=(const CAircraftCfgEntries &other) const - { - if (this == &other) return false; - return !((*this) == other); - } - /* * String representation */ @@ -115,79 +97,5 @@ namespace BlackSim } } - /* - * Hash - */ - uint CAircraftCfgEntries::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * Register metadata - */ - void CAircraftCfgEntries::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * Compare - */ - int CAircraftCfgEntries::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Metatype - */ - int CAircraftCfgEntries::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * Marshall to DBus - */ - void CAircraftCfgEntries::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from DBus - */ - void CAircraftCfgEntries::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * To JSON - */ - QJsonObject CAircraftCfgEntries::toJson() const - { - return BlackMisc::serializeJson(CAircraftCfgEntries::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - void CAircraftCfgEntries::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAircraftCfgEntries::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CAircraftCfgEntries::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - } } // namespace diff --git a/src/blacksim/fscommon/aircraftcfgentries.h b/src/blacksim/fscommon/aircraftcfgentries.h index 5af1797f0..f7368d280 100644 --- a/src/blacksim/fscommon/aircraftcfgentries.h +++ b/src/blacksim/fscommon/aircraftcfgentries.h @@ -24,7 +24,7 @@ namespace BlackSim * \remarks an entry in the aircraft.cfg is title, atc type, ... This class already bundles * relevant entries, hence the class is named Entries (plural) */ - class CAircraftCfgEntries: public BlackMisc::CValueObject + class CAircraftCfgEntries: public BlackMisc::CValueObjectStdTuple { public: //! Properties by index @@ -52,12 +52,6 @@ namespace BlackSim */ CAircraftCfgEntries(const QString &filePath, qint32 index, const QString &title, const QString &atcType, const QString &atcModel, const QString &atcParkingCode); - //! operator == - bool operator ==(const CAircraftCfgEntries &other) const; - - //! operator != - bool operator !=(const CAircraftCfgEntries &other) const; - //! Filepath QString getFilePath() const { return this->m_filePath; } @@ -94,49 +88,16 @@ namespace BlackSim //! Parking code void setAtcParkingCode(const QString &parkingCode) { this->m_atcParkingCode = parkingCode; } - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const override; - - //! \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); } - - //! \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 virtual void setPropertyByIndex(const QVariant &variant, const BlackMisc::CPropertyIndex &index) override; - //! Register the metatypes - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \copydoc CValueObject::convertToQString virtual QString convertToQString(bool i18n = false) const override; - //! \copydoc CValueObject::marshallToDbus - virtual void marshallToDbus(QDBusArgument &) const override; - - //! \copydoc CValueObject::unmarshallFromDbus - virtual void unmarshallFromDbus(const QDBusArgument &) override; - - //! \copydoc CValueObject::compareImpl - int compareImpl(const CValueObject &otherBase) const override; - - //! \copydoc CValueObject::getMetaTypeId() - int getMetaTypeId() const override; - private: BLACK_ENABLE_TUPLE_CONVERSION(CAircraftCfgEntries) qint32 m_index; //!< current index in given config diff --git a/src/blacksim/fscommon/aircraftmapping.cpp b/src/blacksim/fscommon/aircraftmapping.cpp index e7d1cfa21..5c7b0d4b9 100644 --- a/src/blacksim/fscommon/aircraftmapping.cpp +++ b/src/blacksim/fscommon/aircraftmapping.cpp @@ -42,24 +42,6 @@ namespace BlackSim // void } - /* - * Operator == - */ - bool CAircraftMapping::operator ==(const CAircraftMapping &otherMapping) const - { - if (this == &otherMapping) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(otherMapping); - } - - /* - * Operator != - */ - bool CAircraftMapping::operator !=(const CAircraftMapping &otherMapping) const - { - if (this == &otherMapping) return false; - return !((*this) == otherMapping); - } - /* * String for converter */ @@ -204,71 +186,5 @@ namespace BlackSim } } - /* - * Marshall to Dbus - */ - void CAircraftMapping::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall from Dbus - */ - void CAircraftMapping::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Metatype id - */ - int CAircraftMapping::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * Compare - */ - int CAircraftMapping::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Register metadata - */ - void CAircraftMapping::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - - /* - * To JSON - */ - QJsonObject CAircraftMapping::toJson() const - { - return BlackMisc::serializeJson(CAircraftMapping::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - void CAircraftMapping::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CAircraftMapping::jsonMembers(), TupleConverter::toTuple(*this)); - } - - /* - * Members - */ - const QStringList &CAircraftMapping::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - } // namespace } // namespace diff --git a/src/blacksim/fscommon/aircraftmapping.h b/src/blacksim/fscommon/aircraftmapping.h index c21c5be3e..59fe7ab93 100644 --- a/src/blacksim/fscommon/aircraftmapping.h +++ b/src/blacksim/fscommon/aircraftmapping.h @@ -23,24 +23,11 @@ namespace BlackSim namespace FsCommon { //! Aircraft mapping class, represents one particular mapping - class CAircraftMapping : public BlackMisc::CValueObject + class CAircraftMapping : public BlackMisc::CValueObjectStdTuple { public: static const qint32 InvalidId = -1; //!< Invalid mapping id - //! \copydoc CValueObject::marshallToDbus - virtual void marshallToDbus(QDBusArgument &) const override; - - //! \copydoc CValueObject::unmarshallFromDbus - virtual void unmarshallFromDbus(const QDBusArgument &) override; - - //! \copydoc CValueObject::getMetaTypeId() - int getMetaTypeId() const; - - //! \copydoc CValueObject::compareImpl - int compareImpl(const CValueObject &otherBase) const override; - - public: //! Columns enum ColumnIndex { @@ -74,16 +61,6 @@ namespace BlackSim */ CAircraftMapping(qint32 mappingId, qint32 proposalId, const QString &fsAircraftKey, const QString &icaoAircraftDesignator, const QString &icaoAirline, const QString &icaoAircraftType, const QString &icaoWakeTurbulenceCategory, const QString &painting, const QString &lastChanged, CSimulatorInfo simulator); - //! Virtual destructor - virtual ~CAircraftMapping() - {} - - //! operator == - bool operator ==(const CAircraftMapping &otherMapping) const; - - //! operator != - bool operator !=(const CAircraftMapping &otherMapping) const; - //! Mapping id qint32 getMappingId() const { return this->m_mappingId; } @@ -172,12 +149,6 @@ namespace BlackSim //! \copydoc CValueObject::getValueHash() virtual uint getValueHash() const override; - //! \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); } - //! Current UTC timestamp static QString currentUtcTimestamp() { @@ -189,8 +160,6 @@ namespace BlackSim protected: //! \copydoc CValueObject::convertToQString virtual QString convertToQString(bool i18n = false) const; - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; private: BLACK_ENABLE_TUPLE_CONVERSION(CAircraftMapping) @@ -205,14 +174,6 @@ namespace BlackSim QString m_lastChanged; //!< Simple timestamp as YYYYMMDDhhmmss BlackSim::CSimulatorInfo m_simulatorInfo; //!< Mapping is for simulator bool m_changed; //! Changed flag - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! Register metadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); }; } // namespace } // namespace diff --git a/src/blacksim/setsimulator.cpp b/src/blacksim/setsimulator.cpp index 72135506c..ba2449d61 100644 --- a/src/blacksim/setsimulator.cpp +++ b/src/blacksim/setsimulator.cpp @@ -37,97 +37,6 @@ namespace BlackSim return s; } - /* - * metaTypeId - */ - int CSettingsSimulator::getMetaTypeId() const - { - return qMetaTypeId(); - } - - /* - * is a - */ - bool CSettingsSimulator::isA(int metaTypeId) const - { - if (metaTypeId == qMetaTypeId()) { return true; } - return this->CValueObject::isA(metaTypeId); - } - - /* - * Compare - */ - int CSettingsSimulator::compareImpl(const CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - /* - * Marshall - */ - void CSettingsSimulator::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - /* - * Unmarshall - */ - void CSettingsSimulator::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - /* - * Equal? - */ - bool CSettingsSimulator::operator ==(const CSettingsSimulator &other) const - { - if (this == &other) return true; - return compare(*this, other) == 0; - } - - /* - * Unequal? - */ - bool CSettingsSimulator::operator !=(const CSettingsSimulator &other) const - { - return !((*this) == other); - } - - /* - * Hash - */ - uint CSettingsSimulator::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - - /* - * To JSON - */ - QJsonObject CSettingsSimulator::toJson() const - { - return BlackMisc::serializeJson(TupleConverter::toMetaTuple(*this)); - } - - /* - * From JSON - */ - void CSettingsSimulator::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, TupleConverter::toMetaTuple(*this)); - } - - /* - * Members - */ - const QStringList &CSettingsSimulator::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - /* * Default values */ @@ -138,15 +47,6 @@ namespace BlackSim this->m_timeSync = false; } - /* - * Register metadata - */ - void CSettingsSimulator::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } - /* * Value */ diff --git a/src/blacksim/setsimulator.h b/src/blacksim/setsimulator.h index ca4ce6fd9..933702215 100644 --- a/src/blacksim/setsimulator.h +++ b/src/blacksim/setsimulator.h @@ -23,7 +23,7 @@ namespace BlackSim namespace Settings { //! Value object encapsulating information of simulator related settings. - class CSettingsSimulator : public BlackMisc::CValueObject + class CSettingsSimulator : public BlackMisc::CValueObjectStdTuple { public: //! Default constructor. @@ -68,58 +68,16 @@ namespace BlackSim //! Set time synchronization void setTimeSyncEnabled(bool enabled) { this->m_timeSync = enabled; } - //! Equal operator == - bool operator ==(const CSettingsSimulator &other) const; - - //! Unequal operator != - bool operator !=(const CSettingsSimulator &other) const; - //! Init with meaningful default values void initDefaultValues(); //! \copydoc BlackCore::IContextSettings::value virtual BlackMisc::CStatusMessage value(const QString &path, const QString &command, const BlackMisc::CVariant &value, bool &changedFlag); - //! \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; - - //! \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); } - - //! \copydoc CValueObject::registerMetadata - static void registerMetadata(); - - //! JSON member names - static const QStringList &jsonMembers(); - protected: //! \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(CSettingsSimulator) BlackSim::CSimulatorInfo m_selectedPlugin; diff --git a/src/blacksim/simulatorinfo.cpp b/src/blacksim/simulatorinfo.cpp index 9a9341ccf..a45d8ca00 100644 --- a/src/blacksim/simulatorinfo.cpp +++ b/src/blacksim/simulatorinfo.cpp @@ -22,11 +22,6 @@ namespace BlackSim CSimulatorInfo::CSimulatorInfo() : m_fullName("Unknown"), m_shortName("Unknown") {} - uint CSimulatorInfo::getValueHash() const - { - return qHash(TupleConverter::toTuple(*this)); - } - QVariant CSimulatorInfo::getSimulatorSetupValue(int index) const { return this->m_simsetup.value(index); @@ -55,57 +50,4 @@ namespace BlackSim Q_UNUSED(i18n); return QString(this->m_shortName).append(" (").append(this->m_fullName).append(")"); } - - int CSimulatorInfo::getMetaTypeId() const - { - return qMetaTypeId(); - } - - bool CSimulatorInfo::operator ==(const CSimulatorInfo &other) const - { - if (this == &other) return true; - return TupleConverter::toTuple(*this) == TupleConverter::toTuple(other); - } - - bool CSimulatorInfo::operator !=(const CSimulatorInfo &other) const - { - return !((*this) == other); - } - - int CSimulatorInfo::compareImpl(const BlackMisc::CValueObject &otherBase) const - { - const auto &other = static_cast(otherBase); - return compare(TupleConverter::toTuple(*this), TupleConverter::toTuple(other)); - } - - void CSimulatorInfo::marshallToDbus(QDBusArgument &argument) const - { - argument << TupleConverter::toTuple(*this); - } - - void CSimulatorInfo::unmarshallFromDbus(const QDBusArgument &argument) - { - argument >> TupleConverter::toTuple(*this); - } - - const QStringList &CSimulatorInfo::jsonMembers() - { - return TupleConverter::jsonMembers(); - } - - QJsonObject CSimulatorInfo::toJson() const - { - return BlackMisc::serializeJson(CSimulatorInfo::jsonMembers(), TupleConverter::toTuple(*this)); - } - - void CSimulatorInfo::convertFromJson(const QJsonObject &json) - { - BlackMisc::deserializeJson(json, CSimulatorInfo::jsonMembers(), TupleConverter::toTuple(*this)); - } - - void CSimulatorInfo::registerMetadata() - { - qRegisterMetaType(); - qDBusRegisterMetaType(); - } } diff --git a/src/blacksim/simulatorinfo.h b/src/blacksim/simulatorinfo.h index b5c9d56df..06320b7ef 100644 --- a/src/blacksim/simulatorinfo.h +++ b/src/blacksim/simulatorinfo.h @@ -16,7 +16,7 @@ namespace BlackSim { //! Describing a simulator - class CSimulatorInfo : public BlackMisc::CValueObject + class CSimulatorInfo : public BlackMisc::CValueObjectStdTuple { public: //! Default constructor @@ -28,12 +28,6 @@ namespace BlackSim //! Unspecified simulator bool isUnspecified() const { return this->m_shortName.isEmpty() || this->m_shortName.startsWith("Unspecified", Qt::CaseInsensitive); } - //! Equal operator == - bool operator ==(const CSimulatorInfo &other) const; - - //! Unequal operator != - bool operator !=(const CSimulatorInfo &other) const; - //! Single setting value QVariant getSimulatorSetupValue(int index) const; @@ -52,27 +46,6 @@ namespace BlackSim //! Compare on names only, ignore setup bool isSameSimulator(const CSimulatorInfo &otherSimulator) const; - //! \copydoc CValueObject::getValueHash() - virtual uint getValueHash() const override; - - //! \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); } - - //! \copydoc CValueObject::toJson - virtual QJsonObject toJson() const override; - - //! \copydoc CValueObject::convertFromJson - virtual void convertFromJson(const QJsonObject &json) override; - - //! JSON member names - static const QStringList &jsonMembers(); - - //! Register the metatypes - static void registerMetadata(); - //! Simulator is FS9 - Microsoft Flight Simulator 2004 static const CSimulatorInfo &FS9() { @@ -105,18 +78,6 @@ namespace BlackSim //! \copydoc CValueObject::convertToQString virtual QString convertToQString(bool i18n = false) const override; - //! \copydoc CValueObject::getMetaTypeId - virtual int getMetaTypeId() const override; - - //! \copydoc CValueObject::compareImpl - virtual int compareImpl(const CValueObject &otherBase) 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(CSimulatorInfo) QString m_fullName;