summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-06-01 14:20:28 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2019-06-01 14:20:28 +0100
commit33f816ab58c4d2c91e7455940011043107a7b1da (patch)
tree31e854c3ed7505f442f46895929ec07d078a47af
parentAdd MemStream (diff)
downloadlibadhocutil-33f816ab58c4d2c91e7455940011043107a7b1da.tar.bz2
libadhocutil-33f816ab58c4d2c91e7455940011043107a7b1da.tar.xz
libadhocutil-33f816ab58c4d2c91e7455940011043107a7b1da.zip
Don't default destructor
Allows for use of plugin manager in other code (without full definition of contained types)
-rw-r--r--libadhocutil/plugins.cpp2
-rw-r--r--libadhocutil/plugins.h2
-rw-r--r--libadhocutil/unittests/testPlugins.cpp5
3 files changed, 8 insertions, 1 deletions
diff --git a/libadhocutil/plugins.cpp b/libadhocutil/plugins.cpp
index 9c13bf4..86dc2c5 100644
--- a/libadhocutil/plugins.cpp
+++ b/libadhocutil/plugins.cpp
@@ -85,6 +85,8 @@ namespace AdHoc {
{
}
+ PluginManager::~PluginManager() = default;
+
PluginManager *
PluginManager::getDefault()
{
diff --git a/libadhocutil/plugins.h b/libadhocutil/plugins.h
index 42d6062..ce3447a 100644
--- a/libadhocutil/plugins.h
+++ b/libadhocutil/plugins.h
@@ -100,7 +100,7 @@ namespace AdHoc {
typedef std::function<std::optional<std::string> (const std::type_info &, const std::string_view &)> PluginResolver;
PluginManager();
- virtual ~PluginManager() = default;
+ virtual ~PluginManager();
/// Install a plugin.
void add(const PluginPtr &);
diff --git a/libadhocutil/unittests/testPlugins.cpp b/libadhocutil/unittests/testPlugins.cpp
index 8d35822..bdcfe6d 100644
--- a/libadhocutil/unittests/testPlugins.cpp
+++ b/libadhocutil/unittests/testPlugins.cpp
@@ -17,6 +17,11 @@ BOOST_AUTO_TEST_CASE( registered )
BOOST_REQUIRE_EQUAL(1, PluginManager::getDefault()->count());
}
+BOOST_AUTO_TEST_CASE( private_instance )
+{
+ std::make_unique<PluginManager>();
+}
+
BOOST_AUTO_TEST_CASE( get )
{
auto implOfThingPlugin = PluginManager::getDefault()->get<BaseThing>("ImplOfThing");