From 3a7a60b618b82416e6774bd8dff4b706d39e6aaa Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 28 Sep 2015 01:27:01 +0100 Subject: No need for plugin implementations to be const --- libadhocutil/plugins.h | 12 ++++++------ libadhocutil/plugins.impl.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libadhocutil/plugins.h b/libadhocutil/plugins.h index d73ffec..69d0182 100644 --- a/libadhocutil/plugins.h +++ b/libadhocutil/plugins.h @@ -47,7 +47,7 @@ namespace AdHoc { virtual const std::type_info & type() const = 0; /// Get the abstract base plugin implementation. - virtual const AbstractPluginImplementation * implementation() const = 0; + virtual AbstractPluginImplementation * implementation() const = 0; /// The name the plugin was installed with. const std::string name; @@ -84,16 +84,16 @@ namespace AdHoc { class DLL_PUBLIC PluginOf : public Plugin { public: /// Constructor taking an instance and name, filename and line of install for Plugin. - PluginOf(const T * t, const std::string & n, const std::string & f, int l); + PluginOf(T * t, const std::string & n, const std::string & f, int l); ~PluginOf(); /// Get the type of this plugin. const std::type_info & type() const override; /// Get the implementation of this plugin. - const T * implementation() const override; + T * implementation() const override; private: - const T * impl; + T * impl; }; /// Container for loaded plugins. @@ -124,7 +124,7 @@ namespace AdHoc { * @param f Filename of plugin. * @param l Line number. */ - template void add(const T * i, const std::string & n, const std::string & f, int l); + template void add(T * i, const std::string & n, const std::string & f, int l); /** * Uninstall a plugin. @@ -142,7 +142,7 @@ namespace AdHoc { * Get the implementation from specific plugin. * @param n Name of plugin. */ - template const T * getImplementation(const std::string & n) const; + template T * getImplementation(const std::string & n) const; /** * Get all plugins of a given time. diff --git a/libadhocutil/plugins.impl.h b/libadhocutil/plugins.impl.h index 9a2a880..1947845 100644 --- a/libadhocutil/plugins.impl.h +++ b/libadhocutil/plugins.impl.h @@ -5,7 +5,7 @@ namespace AdHoc { template - PluginOf::PluginOf(const T * t, const std::string & n, const std::string & f, int l) : + PluginOf::PluginOf(T * t, const std::string & n, const std::string & f, int l) : Plugin(n, f, l), impl(t) { @@ -27,7 +27,7 @@ namespace AdHoc { /// Get the implementation of this plugin. template - const T * + T * PluginOf::implementation() const { return impl; @@ -35,7 +35,7 @@ namespace AdHoc { template void - PluginManager::add(const T * i, const std::string & n, const std::string & f, int l) + PluginManager::add(T * i, const std::string & n, const std::string & f, int l) { add(PluginPtr(new PluginOf(i, n, f, l))); } @@ -55,7 +55,7 @@ namespace AdHoc { } template - const T * + T * PluginManager::getImplementation(const std::string & n) const { return get(n)->implementation(); @@ -91,10 +91,10 @@ namespace AdHoc { #define INSTANTIATEPLUGINOF(T) \ template class AdHoc::PluginOf; \ - template void AdHoc::PluginManager::add(const T *, const std::string &, const std::string &, int); \ + template void AdHoc::PluginManager::add(T *, const std::string &, const std::string &, int); \ template void AdHoc::PluginManager::remove(const std::string &); \ template boost::shared_ptr> AdHoc::PluginManager::get(const std::string &) const; \ - template const T * AdHoc::PluginManager::getImplementation(const std::string &) const; \ + template T * AdHoc::PluginManager::getImplementation(const std::string &) const; \ template std::set>> AdHoc::PluginManager::getAll() const; \ template void AdHoc::PluginManager::addResolver(const AdHoc::PluginManager::PluginResolver & f); \ template void AdHoc::PluginManager::removeResolver(); \ -- cgit v1.2.3