mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 10:15:43 +08:00
[Clang][Windows] Remove workarounds
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
* \def BLACKGUI_EXPORT
|
* \def BLACKGUI_EXPORT
|
||||||
* Export a class or function from the library
|
* Export a class or function from the library
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WITH_STATIC
|
#ifndef WITH_STATIC
|
||||||
# if defined(BUILD_BLACKGUI_LIB)
|
# if defined(BUILD_BLACKGUI_LIB)
|
||||||
# define BLACKGUI_EXPORT Q_DECL_EXPORT
|
# define BLACKGUI_EXPORT Q_DECL_EXPORT
|
||||||
@@ -32,20 +31,10 @@
|
|||||||
* \def BLACKGUI_EXPORT_DECLARE_TEMPLATE
|
* \def BLACKGUI_EXPORT_DECLARE_TEMPLATE
|
||||||
* BLACKGUI Export explicit template declaration
|
* BLACKGUI Export explicit template declaration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
* \def BLACKGUI_EXPORT_DEFINE_TEMPLATE
|
|
||||||
* BLACKGUI Export explicit template definition
|
|
||||||
*/
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||||
# define BLACKGUI_EXPORT_DECLARE_TEMPLATE BLACKGUI_EXPORT
|
# define BLACKGUI_EXPORT_DECLARE_TEMPLATE BLACKGUI_EXPORT
|
||||||
# define BLACKGUI_EXPORT_DEFINE_TEMPLATE
|
|
||||||
#elif defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
# define BLACKGUI_EXPORT_DECLARE_TEMPLATE
|
|
||||||
# define BLACKGUI_EXPORT_DEFINE_TEMPLATE BLACKGUI_EXPORT
|
|
||||||
#else
|
#else
|
||||||
# define BLACKGUI_EXPORT_DECLARE_TEMPLATE
|
# define BLACKGUI_EXPORT_DECLARE_TEMPLATE
|
||||||
# define BLACKGUI_EXPORT_DEFINE_TEMPLATE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -32,12 +32,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Audio::CAudioDeviceInfoList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Audio::CAudioDeviceInfo>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -261,9 +261,9 @@ namespace BlackMisc::Aviation
|
|||||||
// see here for the reason of the forward instantiations
|
// see here for the reason of the forward instantiations
|
||||||
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CModulator<CComSystem>;
|
template class CModulator<CComSystem>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CModulator<CNavSystem>;
|
template class CModulator<CNavSystem>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CModulator<CAdfSystem>;
|
template class CModulator<CAdfSystem>;
|
||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -55,30 +55,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAircraftEngineList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAircraftIcaoCodeList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAircraftCategoryList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAircraftPartsList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAircraftSituationList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAirlineIcaoCodeList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAirportList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CAtcStationList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CFlightPlanList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Aviation::CLiveryList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAircraftEngine>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAircraftIcaoCode>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAircraftCategory>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAircraftParts>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAircraftSituation>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAirlineIcaoCode>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAirport>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CAtcStation>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CFlightPlan>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Aviation::CLivery>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -31,20 +31,10 @@
|
|||||||
* \def BLACKMISC_EXPORT_DECLARE_TEMPLATE
|
* \def BLACKMISC_EXPORT_DECLARE_TEMPLATE
|
||||||
* Export explicit template declaration
|
* Export explicit template declaration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
* \def BLACKMISC_EXPORT_DEFINE_TEMPLATE
|
|
||||||
* Export explicit template definition
|
|
||||||
*/
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||||
# define BLACKMISC_EXPORT_DECLARE_TEMPLATE BLACKMISC_EXPORT
|
# define BLACKMISC_EXPORT_DECLARE_TEMPLATE BLACKMISC_EXPORT
|
||||||
# define BLACKMISC_EXPORT_DEFINE_TEMPLATE
|
|
||||||
#elif defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
# define BLACKMISC_EXPORT_DECLARE_TEMPLATE
|
|
||||||
# define BLACKMISC_EXPORT_DEFINE_TEMPLATE BLACKMISC_EXPORT
|
|
||||||
#else
|
#else
|
||||||
# define BLACKMISC_EXPORT_DECLARE_TEMPLATE
|
# define BLACKMISC_EXPORT_DECLARE_TEMPLATE
|
||||||
# define BLACKMISC_EXPORT_DEFINE_TEMPLATE
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -27,16 +27,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Db::CDbInfoList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Db::CArtifactList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Db::CDistributionList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Db::CDbInfo>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Db::CArtifact>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Db::CDistribution>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ namespace BlackMisc::Geo
|
|||||||
// see here for the reason of thess forward instantiations
|
// see here for the reason of thess forward instantiations
|
||||||
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CEarthAngle<CLatitude>;
|
template class CEarthAngle<CLatitude>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CEarthAngle<CLongitude>;
|
template class CEarthAngle<CLongitude>;
|
||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -24,12 +24,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Geo::CCoordinateGeodeticList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Geo::CCoordinateGeodetic>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -30,16 +30,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Input::CActionHotkeyList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Input::CJoystickButtonList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Input::CKeyboardKeyList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Input::CActionHotkey>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Input::CJoystickButton>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Input::CKeyboardKey>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "blackmisc/inheritancetraits.h"
|
#include "blackmisc/inheritancetraits.h"
|
||||||
#include "blackmisc/propertyindexref.h"
|
#include "blackmisc/propertyindexref.h"
|
||||||
#include "blackmisc/variantprivate.h"
|
#include "blackmisc/variant.h"
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -79,23 +79,6 @@ namespace BlackMisc
|
|||||||
// *INDENT-ON*
|
// *INDENT-ON*
|
||||||
|
|
||||||
} // Mixin
|
} // Mixin
|
||||||
|
|
||||||
/*!
|
|
||||||
* This registers the value type T with the BlackMisc meta type system,
|
|
||||||
* making it available for use with the extended feature set of BlackMisc::CVariant.
|
|
||||||
*
|
|
||||||
* The implementation (ab)uses the QMetaType converter function registration mechanism
|
|
||||||
* to store a type-erased representation of the set of operations supported by T.
|
|
||||||
*/
|
|
||||||
template <typename T>
|
|
||||||
void registerMetaValueType()
|
|
||||||
{
|
|
||||||
if (QMetaType::hasRegisteredConverterFunction<T, Private::IValueObjectMetaInfo *>()) { return; }
|
|
||||||
auto converter = [](const T &) { static Private::CValueObjectMetaInfo<T> info; return &info; };
|
|
||||||
bool ok = QMetaType::registerConverter<T, Private::IValueObjectMetaInfo *>(converter);
|
|
||||||
Q_ASSERT(ok);
|
|
||||||
Q_UNUSED(ok);
|
|
||||||
}
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,31 +52,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CClientList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CEcosystemList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CRawFsdMessageList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CRemoteFileList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CRoleList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CServerList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CTextMessageList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CUrlList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CFailoverUrlList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CUrlLogList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Network::CUserList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CClient>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CEcosystem>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CRawFsdMessage>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CRemoteFile>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CRole>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CServer>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CTextMessage>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CUrl>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CUrlLog>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Network::CUser>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -577,15 +577,15 @@ namespace BlackMisc::PhysicalQuantities
|
|||||||
// see here for the reason of thess forward instantiations
|
// see here for the reason of thess forward instantiations
|
||||||
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CLengthUnit, CLength>;
|
template class CPhysicalQuantity<CLengthUnit, CLength>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CPressureUnit, CPressure>;
|
template class CPhysicalQuantity<CPressureUnit, CPressure>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CFrequencyUnit, CFrequency>;
|
template class CPhysicalQuantity<CFrequencyUnit, CFrequency>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CMassUnit, CMass>;
|
template class CPhysicalQuantity<CMassUnit, CMass>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CTemperatureUnit, CTemperature>;
|
template class CPhysicalQuantity<CTemperatureUnit, CTemperature>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CSpeedUnit, CSpeed>;
|
template class CPhysicalQuantity<CSpeedUnit, CSpeed>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CAngleUnit, CAngle>;
|
template class CPhysicalQuantity<CAngleUnit, CAngle>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CTimeUnit, CTime>;
|
template class CPhysicalQuantity<CTimeUnit, CTime>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CPhysicalQuantity<CAccelerationUnit, CAcceleration>;
|
template class CPhysicalQuantity<CAccelerationUnit, CAcceleration>;
|
||||||
//! \endcond
|
//! \endcond
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -108,26 +108,4 @@ namespace BlackMisc
|
|||||||
qRegisterMetaTypeStreamOperators<CSequence<double>>();
|
qRegisterMetaTypeStreamOperators<CSequence<double>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<CApplicationInfoList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CCountryList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CIconList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CIdentifierList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CLogCategoryList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CNameVariantPairList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CPropertyIndexList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CStatusMessageList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CApplicationInfo>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CCountry>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CIcon>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CIdentifier>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CLogCategory>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CNameVariantPair>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CPropertyIndex>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<CStatusMessage>>(int);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -887,7 +887,7 @@ namespace BlackMisc::Simulation
|
|||||||
// see here for the reason of thess forward instantiations
|
// see here for the reason of thess forward instantiations
|
||||||
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CInterpolator<CInterpolatorLinear>;
|
template class CInterpolator<CInterpolatorLinear>;
|
||||||
template class BLACKMISC_EXPORT_DEFINE_TEMPLATE CInterpolator<CInterpolatorSpline>;
|
template class CInterpolator<CInterpolatorSpline>;
|
||||||
//! \endcond
|
//! \endcond
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -85,26 +85,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::FsCommon::CAircraftCfgEntriesList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CAircraftModelList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CDistributorList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CInterpolationSetupList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CMatchingStatistics>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CSimulatedAircraftList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CSimulatorInfoList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Simulation::CSimulatorPluginInfoList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::FsCommon::CAircraftCfgEntries>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CAircraftModel>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CDistributor>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CInterpolationAndRenderingSetupPerCallsign>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CMatchingStatisticsEntry>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CSimulatedAircraft>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CSimulatorInfo>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Simulation::CSimulatorPluginInfo>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -522,6 +522,28 @@ namespace BlackMisc
|
|||||||
return CIcon(toIcon()).toPixmap();
|
return CIcon(toIcon()).toPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CVariant::registerMetadata()
|
||||||
|
{
|
||||||
|
Private::MetaTypeHelper<CVariant>::maybeRegisterMetaType();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CVariant::getMetaTypeId() const
|
||||||
|
{
|
||||||
|
return Private::MetaTypeHelper<CVariant>::maybeGetMetaTypeId();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CVariant::getClassName() const
|
||||||
|
{
|
||||||
|
return QMetaType::typeName(getMetaTypeId());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVariant::isA(int metaTypeId) const
|
||||||
|
{
|
||||||
|
if (metaTypeId == QMetaType::UnknownType) { return false; }
|
||||||
|
if (metaTypeId == getMetaTypeId()) { return true; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CVariant::matches(const CVariant &value) const
|
bool CVariant::matches(const CVariant &value) const
|
||||||
{
|
{
|
||||||
if (! isValid()) { return false; }
|
if (! isValid()) { return false; }
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
#include "blackmisc/mixin/mixinjson.h"
|
#include "blackmisc/mixin/mixinjson.h"
|
||||||
#include "blackmisc/range.h"
|
#include "blackmisc/range.h"
|
||||||
#include "blackmisc/mixin/mixinstring.h"
|
#include "blackmisc/mixin/mixinstring.h"
|
||||||
#include "blackmisc/mixin/mixinmetatype.h"
|
|
||||||
#include "blackmisc/variantprivate.h"
|
#include "blackmisc/variantprivate.h"
|
||||||
#include "blackmisc/icons.h"
|
#include "blackmisc/icons.h"
|
||||||
|
|
||||||
@@ -40,12 +39,28 @@ namespace BlackMisc
|
|||||||
class CIcon;
|
class CIcon;
|
||||||
class CPropertyIndex;
|
class CPropertyIndex;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* This registers the value type T with the BlackMisc meta type system,
|
||||||
|
* making it available for use with the extended feature set of BlackMisc::CVariant.
|
||||||
|
*
|
||||||
|
* The implementation (ab)uses the QMetaType converter function registration mechanism
|
||||||
|
* to store a type-erased representation of the set of operations supported by T.
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
void registerMetaValueType()
|
||||||
|
{
|
||||||
|
if (QMetaType::hasRegisteredConverterFunction<T, Private::IValueObjectMetaInfo *>()) { return; }
|
||||||
|
auto converter = [](const T &) { static Private::CValueObjectMetaInfo<T> info; return &info; };
|
||||||
|
bool ok = QMetaType::registerConverter<T, Private::IValueObjectMetaInfo *>(converter);
|
||||||
|
Q_ASSERT(ok);
|
||||||
|
Q_UNUSED(ok);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Wrapper around QVariant which provides transparent access to CValueObject methods
|
* Wrapper around QVariant which provides transparent access to CValueObject methods
|
||||||
* of the contained object if it is registered with BlackMisc::registerMetaValueType.
|
* of the contained object if it is registered with BlackMisc::registerMetaValueType.
|
||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT CVariant :
|
class BLACKMISC_EXPORT CVariant :
|
||||||
public Mixin::MetaType<CVariant>,
|
|
||||||
public Mixin::EqualsByCompare<CVariant>,
|
public Mixin::EqualsByCompare<CVariant>,
|
||||||
public Mixin::LessThanByCompare<CVariant>,
|
public Mixin::LessThanByCompare<CVariant>,
|
||||||
public Mixin::DBusOperators<CVariant>,
|
public Mixin::DBusOperators<CVariant>,
|
||||||
@@ -267,6 +282,18 @@ namespace BlackMisc
|
|||||||
//! \copydoc BlackMisc::Mixin::Icon::toIcon
|
//! \copydoc BlackMisc::Mixin::Icon::toIcon
|
||||||
CIcons::IconIndex toIcon() const;
|
CIcons::IconIndex toIcon() const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::MetaType::registerMetadata
|
||||||
|
static void registerMetadata();
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::MetaType::getMetaTypeId
|
||||||
|
int getMetaTypeId() const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::MetaType::getClassName
|
||||||
|
QString getClassName() const;
|
||||||
|
|
||||||
|
//! \copydoc BlackMisc::Mixin::MetaType::isA
|
||||||
|
bool isA(int metaTypeId) const;
|
||||||
|
|
||||||
//! If this is an event subscription, return true if it matches the given event.
|
//! If this is an event subscription, return true if it matches the given event.
|
||||||
bool matches(const CVariant &event) const;
|
bool matches(const CVariant &event) const;
|
||||||
|
|
||||||
@@ -303,21 +330,25 @@ Q_DECLARE_METATYPE(BlackMisc::CVariant)
|
|||||||
|
|
||||||
namespace BlackMisc::Private
|
namespace BlackMisc::Private
|
||||||
{
|
{
|
||||||
//! \private
|
//! \cond PRIVATE
|
||||||
template <typename T, typename>
|
template <typename T>
|
||||||
void maybeRegisterMetaListConvert(int)
|
void MetaTypeHelper<T>::maybeRegisterMetaList()
|
||||||
{
|
{
|
||||||
if (QMetaType::hasRegisteredConverterFunction(qMetaTypeId<T>(), qMetaTypeId<QVector<CVariant>>())) { return; }
|
if constexpr (canConvertVariantList<T>(0))
|
||||||
|
{
|
||||||
|
if (QMetaType::hasRegisteredConverterFunction(qMetaTypeId<T>(), qMetaTypeId<QVector<CVariant>>())) { return; }
|
||||||
|
|
||||||
QMetaType::registerConverter<T, QVector<CVariant>>([](const T &list) -> QVector<CVariant>
|
QMetaType::registerConverter<T, QVector<CVariant>>([](const T &list) -> QVector<CVariant>
|
||||||
{
|
{
|
||||||
return list.transform([](const typename T::value_type &v) { return CVariant::from(v); });
|
return list.transform([](const typename T::value_type &v) { return CVariant::from(v); });
|
||||||
});
|
});
|
||||||
QMetaType::registerConverter<QVector<CVariant>, T>([](const QVector<CVariant> &list) -> T
|
QMetaType::registerConverter<QVector<CVariant>, T>([](const QVector<CVariant> &list) -> T
|
||||||
{
|
{
|
||||||
return makeRange(list).transform([](const CVariant &v) { return v.to<typename T::value_type>(); });
|
return makeRange(list).transform([](const CVariant &v) { return v.to<typename T::value_type>(); });
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//! \endcond
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "blackmisc/blackmiscexport.h"
|
#include "blackmisc/blackmiscexport.h"
|
||||||
#include "blackmisc/inheritancetraits.h"
|
#include "blackmisc/inheritancetraits.h"
|
||||||
|
#include "blackmisc/propertyindexref.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QDBusMetaType>
|
#include <QDBusMetaType>
|
||||||
@@ -229,9 +230,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
template <typename T, typename = std::enable_if_t<std::is_base_of_v<CSequence<typename T::value_type>, T> && ! std::is_same_v<typename T::value_type, CVariant>>>
|
template <typename T, typename = std::enable_if_t<std::is_base_of_v<CSequence<typename T::value_type>, T> && ! std::is_same_v<typename T::value_type, CVariant>>>
|
||||||
void maybeRegisterMetaListConvert(int);
|
constexpr bool canConvertVariantList(int) { return true; }
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void maybeRegisterMetaListConvert(...) {}
|
constexpr bool canConvertVariantList(...) { return false; }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct MetaTypeHelper
|
struct MetaTypeHelper
|
||||||
@@ -249,9 +250,10 @@ namespace BlackMisc
|
|||||||
qDBusRegisterMetaType<T>();
|
qDBusRegisterMetaType<T>();
|
||||||
qRegisterMetaTypeStreamOperators<T>();
|
qRegisterMetaTypeStreamOperators<T>();
|
||||||
registerMetaValueType<T>();
|
registerMetaValueType<T>();
|
||||||
maybeRegisterMetaListConvert<T>(0);
|
maybeRegisterMetaList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static void maybeRegisterMetaList();
|
||||||
};
|
};
|
||||||
//! \endcond
|
//! \endcond
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,24 +37,4 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_CLANG)
|
|
||||||
namespace Private
|
|
||||||
{
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CCloudLayerList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CMetarList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CPresentWeatherList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CTemperatureLayerList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CVisibilityLayerList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CWeatherDataPluginInfoList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<Weather::CWindLayerList>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CCloudLayer>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CMetar>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CPresentWeather>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CTemperatureLayer>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CVisibilityLayer>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CWeatherDataPluginInfo>>(int);
|
|
||||||
template void maybeRegisterMetaListConvert<CSequence<Weather::CWindLayer>>(int);
|
|
||||||
} // ns
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user