diff --git a/src/blackmisc/aviation/callsignobjectlist.h b/src/blackmisc/aviation/callsignobjectlist.h index 5c53e8d1f..1049932e2 100644 --- a/src/blackmisc/aviation/callsignobjectlist.h +++ b/src/blackmisc/aviation/callsignobjectlist.h @@ -22,6 +22,31 @@ namespace BlackMisc { + + namespace Aviation + { + class CAircraftSituation; + class CAircraftSituationList; + class CAircraftParts; + class CAircraftPartsList; + class CAircraft; + class CAircraftList; + class CAtcStation; + class CAtcStationList; + } + + namespace Simulation + { + class CSimulatedAircraft; + class CSimulatedAircraftList; + } + + namespace Network + { + class CClient; + class CClientList; + } + namespace Aviation { //! List of objects with callsign. @@ -83,6 +108,13 @@ namespace BlackMisc CONTAINER &container(); }; + extern template class ICallsignObjectList; + extern template class ICallsignObjectList; + extern template class ICallsignObjectList; + extern template class ICallsignObjectList; + extern template class ICallsignObjectList; + extern template class ICallsignObjectList; + } //namespace } // namespace diff --git a/src/blackmisc/aviation/modulator.cpp b/src/blackmisc/aviation/modulator.cpp index 425c6b446..c83ca71ca 100644 --- a/src/blackmisc/aviation/modulator.cpp +++ b/src/blackmisc/aviation/modulator.cpp @@ -85,6 +85,18 @@ namespace BlackMisc } } + template + AVIO const *CModulator::derived() const + { + return static_cast(this); + } + + template + AVIO *CModulator::derived() + { + return static_cast(this); + } + // see here for the reason of thess forward instantiations // http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html template class CModulator; diff --git a/src/blackmisc/aviation/modulator.h b/src/blackmisc/aviation/modulator.h index 93d230064..9956c435a 100644 --- a/src/blackmisc/aviation/modulator.h +++ b/src/blackmisc/aviation/modulator.h @@ -22,6 +22,10 @@ namespace BlackMisc namespace Aviation { + class CComSystem; + class CNavSystem; + class CAdfSystem; + //! Base class for COM, NAV, Squawk units. template class CModulator : public CValueObject, CAvionicsBase> { @@ -209,12 +213,16 @@ namespace BlackMisc bool m_enabled = true; //!< is enabled, used e.g. for mute etc. //! Easy access to derived class (CRTP template parameter) - AVIO const *derived() const { return static_cast(this); } + AVIO const *derived() const; //! Easy access to derived class (CRTP template parameter) - AVIO *derived() { return static_cast(this); } + AVIO *derived(); }; + extern template class CModulator; + extern template class CModulator; + extern template class CModulator; + } } diff --git a/src/blackmisc/blackmiscfreefunctions.cpp b/src/blackmisc/blackmiscfreefunctions.cpp index 9d64a979c..4280e0604 100644 --- a/src/blackmisc/blackmiscfreefunctions.cpp +++ b/src/blackmisc/blackmiscfreefunctions.cpp @@ -244,26 +244,6 @@ QVariant BlackMisc::complexQtTypeFromDbusArgument(const QDBusArgument &argument, return QVariant(); // suppress compiler warning } -template QString BlackMisc::qmapToString(const QMap &map) -{ - QString s; - const QString kv("%1: %2 "); - QMapIterator i(map); - while (i.hasNext()) - { - i.next(); - s.append( - kv.arg(i.key()).arg(i.value()) - ); - } - return s.trimmed(); -} - -// forward declare: http://www.parashift.com/c++-faq-lite/separate-template-fn-defn-from-decl.html -template QString BlackMisc::qmapToString(const QMap &); -template QString BlackMisc::qmapToString(const QMap &); -template QString BlackMisc::qmapToString(const QMap &); - #ifdef Q_CC_MSVC #include diff --git a/src/blackmisc/blackmiscfreefunctions.h b/src/blackmisc/blackmiscfreefunctions.h index 972421764..a75b6847b 100644 --- a/src/blackmisc/blackmiscfreefunctions.h +++ b/src/blackmisc/blackmiscfreefunctions.h @@ -169,7 +169,20 @@ namespace BlackMisc size_t heapSizeOf(const QMetaObject &objectType); //! A map converted to string - template QString qmapToString(const QMap &map); + template QString qmapToString(const QMap &map) + { + QString s; + const QString kv("%1: %2 "); + QMapIterator i(map); + while (i.hasNext()) + { + i.next(); + s.append( + kv.arg(i.key()).arg(i.value()) + ); + } + return s.trimmed(); + } //! Bool to on/off QString boolToOnOff(bool v, bool i18n = false); diff --git a/src/blackmisc/geo/earthangle.h b/src/blackmisc/geo/earthangle.h index 18d3a367e..bbad9ef85 100644 --- a/src/blackmisc/geo/earthangle.h +++ b/src/blackmisc/geo/earthangle.h @@ -26,6 +26,10 @@ namespace BlackMisc namespace Geo { + + class CLatitude; + class CLongitude; + /*! * Base class for latitude / longitude */ @@ -134,6 +138,10 @@ namespace BlackMisc //! Easy access to derived class (CRTP template parameter) LATorLON *derived() { return static_cast(this); } }; + + extern template class CEarthAngle; + extern template class CEarthAngle; + } } diff --git a/src/blackmisc/geo/geoobjectlist.h b/src/blackmisc/geo/geoobjectlist.h index 778b72df2..1df2aabc1 100644 --- a/src/blackmisc/geo/geoobjectlist.h +++ b/src/blackmisc/geo/geoobjectlist.h @@ -18,6 +18,22 @@ namespace BlackMisc { + namespace Aviation + { + class CAtcStation; + class CAtcStationList; + class CAircraft; + class CAircraftList; + class CAirport; + class CAirportList; + } + + namespace Simulation + { + class CSimulatedAircraft; + class CSimulatedAircraftList; + } + namespace Geo { //! List of objects with geo coordinates. @@ -45,6 +61,11 @@ namespace BlackMisc CONTAINER &container(); }; + extern template class IGeoObjectList; + extern template class IGeoObjectList; + extern template class IGeoObjectList; + extern template class IGeoObjectList; + //! List of objects with geo coordinates. template class IGeoObjectWithRelativePositionList : public IGeoObjectList @@ -71,6 +92,11 @@ namespace BlackMisc }; + extern template class IGeoObjectWithRelativePositionList; + extern template class IGeoObjectWithRelativePositionList; + extern template class IGeoObjectWithRelativePositionList; + extern template class IGeoObjectWithRelativePositionList; + } //namespace } // namespace diff --git a/src/blackmisc/pq/physicalquantity.cpp b/src/blackmisc/pq/physicalquantity.cpp index 16f9388ae..bd5ccadaf 100644 --- a/src/blackmisc/pq/physicalquantity.cpp +++ b/src/blackmisc/pq/physicalquantity.cpp @@ -212,6 +212,16 @@ namespace BlackMisc this->m_value = json.value("value").toDouble(); } + template void CPhysicalQuantity::parseFromString(const QString &value, CPqString::SeparatorMode mode) + { + *this = CPqString::parse(value, mode); + } + + template void CPhysicalQuantity::parseFromString(const QString &value) + { + *this = CPqString::parse(value, CPqString::SeparatorsCLocale); + } + template CVariant CPhysicalQuantity::propertyByIndex(const CPropertyIndex &index) const { if (index.isMyself()) { return this->toCVariant(); } diff --git a/src/blackmisc/pq/physicalquantity.h b/src/blackmisc/pq/physicalquantity.h index e2c9dc035..ec095027b 100644 --- a/src/blackmisc/pq/physicalquantity.h +++ b/src/blackmisc/pq/physicalquantity.h @@ -26,7 +26,19 @@ namespace BlackMisc { - namespace PhysicalQuantities { template class CPhysicalQuantity; } + namespace PhysicalQuantities + { + template class CPhysicalQuantity; + class CLength; + class CPressure; + class CFrequency; + class CMass; + class CTemperature; + class CSpeed; + class CTime; + class CPressure; + class CAcceleration; + } //! \private template struct CValueObjectPolicy> : public CValueObjectPolicy<> @@ -227,16 +239,10 @@ namespace BlackMisc virtual void convertFromJson(const QJsonObject &json) override; //! Parse to string, with specified separator - virtual void parseFromString(const QString &value, CPqString::SeparatorMode mode) - { - *this = CPqString::parse(value, mode); - } + virtual void parseFromString(const QString &value, CPqString::SeparatorMode mode); //! \copydoc CValueObject::parseFromString - virtual void parseFromString(const QString &value) override - { - *this = CPqString::parse(value, CPqString::SeparatorsCLocale); - } + virtual void parseFromString(const QString &value) override; //! \copydoc CValueObject::propertyByIndex virtual CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const override; @@ -278,6 +284,17 @@ namespace BlackMisc //! Easy access to derived class (CRTP template parameter) PQ *derived() { return static_cast(this); } }; + + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + extern template class CPhysicalQuantity; + } } diff --git a/src/blackmisc/timestampobjectlist.h b/src/blackmisc/timestampobjectlist.h index b0dc60190..e3134606f 100644 --- a/src/blackmisc/timestampobjectlist.h +++ b/src/blackmisc/timestampobjectlist.h @@ -19,6 +19,24 @@ namespace BlackMisc { + namespace Aviation + { + class CAircraftSituation; + class CAircraftSituationList; + class CAircraftParts; + class CAircraftPartsList; + } + + namespace Network + { + class CTextMessage; + class CTextMessageList; + } + + class CStatusMessage; + class CStatusMessageList; + + //! List of objects with timestamp. //! Such objects should implement \sa ITimestampBased template @@ -83,6 +101,11 @@ namespace BlackMisc CONTAINER &container(); }; + extern template class ITimestampObjectList; + extern template class ITimestampObjectList; + extern template class ITimestampObjectList; + extern template class ITimestampObjectList; + } //namespace #endif //guard