mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
refs #413 Macros to ease the task of disambiguating inherited members when using mixins in an inheritance hierarchy.
This commit is contained in:
@@ -207,6 +207,32 @@ namespace BlackMisc
|
||||
class MetaTypeAndQList : public MetaType<Derived, QList<Derived>>
|
||||
{};
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from Mixin::MetaType,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_METATYPE(DERIVED) \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::registerMetadata; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::getMetaTypeId; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::isA; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::toCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::toQVariant; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::convertFromCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaType<DERIVED>::convertFromQVariant;
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from Mixin::MetaType,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_METATYPE_AND_QLIST(DERIVED) \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::registerMetadata; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::getMetaTypeId; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::isA; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::toCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::toQVariant; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::convertFromCVariant; \
|
||||
using ::BlackMisc::Mixin::MetaTypeAndQList<DERIVED>::convertFromQVariant;
|
||||
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit common methods dealing with hashing instances by metatuple.
|
||||
*/
|
||||
@@ -289,6 +315,14 @@ namespace BlackMisc
|
||||
static void baseUnmarshall(void *, const QDBusArgument &) {}
|
||||
};
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from Mixin::DBusByTuple,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_DBUS(DERIVED) \
|
||||
using ::BlackMisc::Mixin::DBusByTuple<DERIVED>::marshallToDbus; \
|
||||
using ::BlackMisc::Mixin::DBusByTuple<DERIVED>::unmarshallFromDbus;
|
||||
|
||||
/*!
|
||||
* CRTP class template which will generate marshalling operators for a derived class with its own marshalling implementation.
|
||||
*/
|
||||
@@ -363,6 +397,14 @@ namespace BlackMisc
|
||||
static void baseConvertFromJson(void *, const QJsonObject &) {}
|
||||
};
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from Mixin::JsonByTuple,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_JSON(DERIVED) \
|
||||
using ::BlackMisc::Mixin::JsonByTuple<DERIVED>::toJson; \
|
||||
using ::BlackMisc::Mixin::JsonByTuple<DERIVED>::convertFromJson;
|
||||
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit operator== implemented using its compare function.
|
||||
*/
|
||||
@@ -528,6 +570,16 @@ namespace BlackMisc
|
||||
Derived *derived() { return static_cast<Derived *>(this); }
|
||||
};
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from Mixin::String,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_STRING(DERIVED) \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toQString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toFormattedQString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toStdString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::stringForStreaming;
|
||||
|
||||
/*!
|
||||
* CRTP class template from which a derived class can inherit property indexing functions.
|
||||
*/
|
||||
@@ -582,6 +634,14 @@ namespace BlackMisc
|
||||
Derived *derived() { return static_cast<Derived *>(this); }
|
||||
};
|
||||
|
||||
/*!
|
||||
* When a derived class and a base class both inherit from Mixin::Icon,
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_ICON(DERIVED) \
|
||||
using ::BlackMisc::Mixin::Icon<DERIVED>::toIcon; \
|
||||
using ::BlackMisc::Mixin::Icon<DERIVED>::toPixmap;
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user