diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 18:54:34 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-24 19:32:10 +0100 |
commit | a88e34b21b07f70123926fcb5c505d6afdf99807 (patch) | |
tree | 905059194dcc64c7c163b8912947d8173fd4cc91 /api | |
parent | 5bf85412e4eacf92acc936b6e74bce0e2b1055d9 (diff) |
style/quality only
No functional changes.
- add `override' everywhere where missing
- almost pass clang's `-Wweak-vtables'
- avoid some float/double conversions
- remove unused private members
- make signedness conversions explicit
- put stuff in right namespaces to aid analysis
Diffstat (limited to 'api')
-rw-r--r-- | api/plugin-api.cpp | 47 | ||||
-rw-r--r-- | api/plugin-api.hpp | 11 |
2 files changed, 29 insertions, 29 deletions
diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp index 404ed434..3630beae 100644 --- a/api/plugin-api.cpp +++ b/api/plugin-api.cpp @@ -27,35 +27,27 @@ void BaseDialog::done(int) // these exist so that vtable is emitted in a single compilation unit, not all of them. +Metadata_::Metadata_() = default; Metadata_::~Metadata_() = default; -IFilter::~IFilter() = default; -IProtocol::~IProtocol() = default; -ITracker::~ITracker() = default; -IExtension::~IExtension() = default; - -void ITrackerDialog::register_tracker(ITracker*) {} -void ITrackerDialog::unregister_tracker() {} - -bool ITracker::center() { return false; } - -module_status ITracker::status_ok() -{ - return module_status(); -} - -module_status ITracker::error(const QString& error) -{ - return module_status(error); -} +Metadata::Metadata() = default; +Metadata::~Metadata() = default; -Metadata_::Metadata_() = default; IFilter::IFilter() = default; +IFilter::~IFilter() = default; IFilterDialog::IFilterDialog() = default; +IFilterDialog::~IFilterDialog() = default; IProtocol::IProtocol() = default; +IProtocol::~IProtocol() = default; IProtocolDialog::IProtocolDialog() = default; +IProtocolDialog::~IProtocolDialog() = default; ITracker::ITracker() = default; +ITracker::~ITracker() = default; +bool ITracker::center() { return false; } ITrackerDialog::ITrackerDialog() = default; - +ITrackerDialog::~ITrackerDialog() = default; +void ITrackerDialog::register_tracker(ITracker*) {} +void ITrackerDialog::unregister_tracker() {} +IExtension::~IExtension() = default; IExtensionDialog::~IExtensionDialog() = default; bool module_status::is_ok() const @@ -63,8 +55,8 @@ bool module_status::is_ok() const return error.isNull(); } +module_status_mixin::~module_status_mixin() = default; module_status::module_status(QString error) : error(std::move(error)) {} - module_status module_status_mixin::status_ok() { return {}; } module_status module_status_mixin::error(const QString& error) @@ -72,7 +64,12 @@ module_status module_status_mixin::error(const QString& error) return module_status(error.isEmpty() ? "Unknown error" : error); } -Metadata::Metadata() = default; -Metadata::~Metadata() = default; - +module_status ITracker::status_ok() +{ + return module_status(); +} +module_status ITracker::error(const QString& error) +{ + return module_status(error); +} diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index 52776986..3950ade0 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -84,7 +84,7 @@ class OTR_API_EXPORT Metadata : public TR, public Metadata_ public: Metadata(); - ~Metadata(); + ~Metadata() override; }; struct OTR_API_EXPORT module_status final @@ -104,6 +104,7 @@ struct OTR_API_EXPORT module_status_mixin static module_status error(const QString& error); // return error message on init failure virtual module_status initialize() = 0; // where to return from + virtual ~module_status_mixin(); }; // implement this in filters @@ -125,6 +126,7 @@ struct OTR_API_EXPORT IFilter : module_status_mixin struct OTR_API_EXPORT IFilterDialog : public plugin_api::detail::BaseDialog { IFilterDialog(); + ~IFilterDialog() override; // optional destructor //~IFilterDialog() override; @@ -142,12 +144,11 @@ struct OTR_API_EXPORT IFilterDialog : public plugin_api::detail::BaseDialog struct OTR_API_EXPORT IProtocol : module_status_mixin { IProtocol(); + ~IProtocol() override; IProtocol(const IProtocol&) = delete; IProtocol& operator=(const IProtocol&) = delete; - // optional destructor - virtual ~IProtocol(); // called 250 times a second with XYZ yaw pitch roll pose // try not to perform intense computation here. use a thread. virtual void pose(const double* headpose) = 0; @@ -165,6 +166,7 @@ struct OTR_API_EXPORT IProtocolDialog : public plugin_api::detail::BaseDialog virtual void unregister_protocol() = 0; IProtocolDialog(); + ~IProtocolDialog() override; }; // call once with your chosen class names in the plugin @@ -203,6 +205,7 @@ struct OTR_API_EXPORT ITrackerDialog : public plugin_api::detail::BaseDialog virtual void unregister_tracker(); ITrackerDialog(); + ~ITrackerDialog() override; }; // call once with your chosen class names in the plugin @@ -231,7 +234,7 @@ struct OTR_API_EXPORT IExtension : module_status_mixin }; IExtension() = default; - virtual ~IExtension(); + ~IExtension() override; virtual event_mask hook_types() = 0; |