From 0459cda9c06549a27d9a62138509cc3d4412e485 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 25 Sep 2016 08:53:32 +0200 Subject: api/plugins: silence clang's -Wweak-vtable --- api/dtors.cpp | 11 ----------- api/plugin-api.cpp | 21 +++++++++++++++++++++ api/plugin-api.hpp | 23 +++++++++++++++++------ 3 files changed, 38 insertions(+), 17 deletions(-) delete mode 100644 api/dtors.cpp create mode 100644 api/plugin-api.cpp (limited to 'api') diff --git a/api/dtors.cpp b/api/dtors.cpp deleted file mode 100644 index 5cc87187..00000000 --- a/api/dtors.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "plugin-api.hpp" - -// these exist only so that vtable is emitted in a single compilation unit, not all of them. - -Metadata::~Metadata() {} -IFilter::~IFilter() {} -IFilterDialog::~IFilterDialog() {} -IProtocol::~IProtocol() {} -IProtocolDialog::~IProtocolDialog() {} -ITracker::~ITracker() {} -ITrackerDialog::~ITrackerDialog() {} diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp new file mode 100644 index 00000000..1bf56200 --- /dev/null +++ b/api/plugin-api.cpp @@ -0,0 +1,21 @@ +#include "plugin-api.hpp" + +// these exist so that vtable is emitted in a single compilation unit, not all of them. + +Metadata::~Metadata() {} +IFilter::~IFilter() {} +IFilterDialog::~IFilterDialog() {} +IProtocol::~IProtocol() {} +IProtocolDialog::~IProtocolDialog() {} +ITracker::~ITracker() {} +ITrackerDialog::~ITrackerDialog() {} + +plugin_api::detail::BaseDialog::BaseDialog() {} +void plugin_api::detail::BaseDialog::closeEvent(QCloseEvent*) { emit closing(); } +Metadata::Metadata() {} +IFilter::IFilter() {} +IFilterDialog::IFilterDialog() {} +IProtocol::IProtocol() {} +IProtocolDialog::IProtocolDialog() {} +ITracker::ITracker() {} +ITrackerDialog::ITrackerDialog() {} diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index 1e5c0fe0..996d32d3 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -29,7 +29,9 @@ #endif enum Axis { - TX, TY, TZ, Yaw, Pitch, Roll + TX = 0, TY = 1, TZ = 2, Yaw = 3, Pitch = 4, Roll = 5, + // for indexing in general + rYaw = 0, rPitch = 1, rRoll = 2, }; namespace plugin_api { @@ -38,8 +40,10 @@ namespace detail { class OPENTRACK_API_EXPORT BaseDialog : public QWidget { Q_OBJECT +protected: + BaseDialog(); public: - void closeEvent(QCloseEvent *) override { emit closing(); } + void closeEvent(QCloseEvent *) override; signals: void closing(); }; @@ -72,7 +76,7 @@ struct OPENTRACK_API_EXPORT Metadata Metadata(const Metadata&) = delete; Metadata(Metadata&&) = delete; Metadata& operator=(const Metadata&) = delete; - inline Metadata() {} + Metadata(); // plugin name to be displayed in the interface virtual QString name() = 0; @@ -88,7 +92,7 @@ struct OPENTRACK_API_EXPORT IFilter IFilter(const IFilter&) = delete; IFilter(IFilter&&) = delete; IFilter& operator=(const IFilter&) = delete; - inline IFilter() {} + IFilter(); // optional destructor virtual ~IFilter(); @@ -101,6 +105,8 @@ struct OPENTRACK_API_EXPORT IFilter struct OPENTRACK_API_EXPORT IFilterDialog : public plugin_api::detail::BaseDialog { + IFilterDialog(); + // optional destructor virtual ~IFilterDialog(); // receive a pointer to the filter from ui thread @@ -116,10 +122,11 @@ struct OPENTRACK_API_EXPORT IFilterDialog : public plugin_api::detail::BaseDialo // implement this in protocols struct OPENTRACK_API_EXPORT IProtocol { + IProtocol(); + IProtocol(const IProtocol&) = delete; IProtocol(IProtocol&&) = delete; IProtocol& operator=(const IProtocol&) = delete; - inline IProtocol() {} // optional destructor virtual ~IProtocol(); @@ -140,6 +147,8 @@ struct OPENTRACK_API_EXPORT IProtocolDialog : public plugin_api::detail::BaseDia virtual void register_protocol(IProtocol *protocol) = 0; // received protocol pointer is about to get deleted virtual void unregister_protocol() = 0; + + IProtocolDialog(); }; // call once with your chosen class names in the plugin @@ -152,7 +161,7 @@ struct OPENTRACK_API_EXPORT ITracker ITracker(const ITracker&) = delete; ITracker(ITracker&&) = delete; ITracker& operator=(const ITracker&) = delete; - inline ITracker() {} + ITracker(); // optional destructor virtual ~ITracker(); @@ -173,6 +182,8 @@ struct OPENTRACK_API_EXPORT ITrackerDialog : public plugin_api::detail::BaseDial virtual void register_tracker(ITracker *tracker) = 0; // received tracker pointer is about to get deleted virtual void unregister_tracker() = 0; + + ITrackerDialog(); }; // call once with your chosen class names in the plugin -- cgit v1.2.3