From a2bdc12f2574e2a129d1a931f8bda173f02491fa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 16 Jan 2018 10:42:46 +0100 Subject: [PATCH] [libcalamares] Drop unused plugin defines - Remove some superfluous intermediate defines - baseFactory was not used (always Calamares::PluginFactory) - Move DECLARATION and DEFINITIONS apart - CALAMARES_PLUGIN_FACTORY_DEFINITION was redefined (identically) - CALAMARES_PLUGIN_FACTORY_DECLARATION was redefined (identically) - __VA_ARGS__ was constant --- src/libcalamares/utils/PluginFactory.h | 85 ++++++-------------------- 1 file changed, 18 insertions(+), 67 deletions(-) diff --git a/src/libcalamares/utils/PluginFactory.h b/src/libcalamares/utils/PluginFactory.h index 8e6704a20..456802555 100644 --- a/src/libcalamares/utils/PluginFactory.h +++ b/src/libcalamares/utils/PluginFactory.h @@ -37,71 +37,6 @@ class PluginFactoryPrivate; #define CalamaresPluginFactory_iid "io.calamares.PluginFactory" -#define CALAMARES_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY_SKEL(name, baseFactory, ...) \ - class name : public Calamares::PluginFactory \ - { \ - Q_OBJECT \ - Q_INTERFACES(Calamares::PluginFactory) \ - __VA_ARGS__ \ - public: \ - explicit name(); \ - ~name(); \ - private: \ - void init(); \ - }; - -#define CALAMARES_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY(name, baseFactory) \ - CALAMARES_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY_SKEL(name, baseFactory, Q_PLUGIN_METADATA(IID CalamaresPluginFactory_iid)) - -#define CALAMARES_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY(name, baseFactory, pluginRegistrations) \ - name::name() \ - { \ - pluginRegistrations \ - } \ - name::~name() {} - -#define CALAMARES_PLUGIN_FACTORY_WITH_BASEFACTORY(name, baseFactory, pluginRegistrations) \ - CALAMARES_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY(name, baseFactory) \ - CALAMARES_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY(name, baseFactory, pluginRegistrations) - -#define CALAMARES_PLUGIN_FACTORY_DECLARATION(name) CALAMARES_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY(name, Calamares::PluginFactory) -#define CALAMARES_PLUGIN_FACTORY_DEFINITION(name, pluginRegistrations) CALAMARES_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY(name, Calamares::PluginFactory, pluginRegistrations) - -/** - * \relates PluginFactory - * - * Create a PluginFactory subclass and export it as the root plugin object. - * - * \param name The name of the PluginFactory derived class. - * - * \param pluginRegistrations Code to be inserted into the constructor of the - * class. Usually a series of registerPlugin() calls. - * - * Example: - * \code - * #include - * #include - * - * class MyPlugin : public PluginInterface - * { - * public: - * MyPlugin(QObject *parent, const QVariantList &args) - * : PluginInterface(parent) - * {} - * }; - * - * CALAMARES_PLUGIN_FACTORY(MyPluginFactory, - * registerPlugin(); - * ) - * - * #include - * \endcode - * - * \see CALAMARES_PLUGIN_FACTORY_DECLARATION - * \see CALAMARES_PLUGIN_FACTORY_DEFINITION - */ -#define CALAMARES_PLUGIN_FACTORY(name, pluginRegistrations) CALAMARES_PLUGIN_FACTORY_WITH_BASEFACTORY(name, Calamares::PluginFactory, pluginRegistrations) - /** * \relates PluginFactory * @@ -113,7 +48,18 @@ class PluginFactoryPrivate; * \see CALAMARES_PLUGIN_FACTORY * \see CALAMARES_PLUGIN_FACTORY_DEFINITION */ -#define CALAMARES_PLUGIN_FACTORY_DECLARATION(name) CALAMARES_PLUGIN_FACTORY_DECLARATION_WITH_BASEFACTORY(name, Calamares::PluginFactory) +#define CALAMARES_PLUGIN_FACTORY_DECLARATION(name) \ + class name : public Calamares::PluginFactory \ + { \ + Q_OBJECT \ + Q_INTERFACES(Calamares::PluginFactory) \ + Q_PLUGIN_METADATA(IID CalamaresPluginFactory_iid) \ + public: \ + explicit name(); \ + ~name(); \ + private: \ + void init(); \ + }; /** * \relates PluginFactory @@ -128,7 +74,12 @@ class PluginFactoryPrivate; * \see CALAMARES_PLUGIN_FACTORY * \see CALAMARES_PLUGIN_FACTORY_DECLARATION */ -#define CALAMARES_PLUGIN_FACTORY_DEFINITION(name, pluginRegistrations) CALAMARES_PLUGIN_FACTORY_DEFINITION_WITH_BASEFACTORY(name, Calamares::PluginFactory, pluginRegistrations) +#define CALAMARES_PLUGIN_FACTORY_DEFINITION(name, pluginRegistrations) \ + name::name() \ + { \ + pluginRegistrations \ + } \ + name::~name() {} namespace Calamares {