From 33f816ab58c4d2c91e7455940011043107a7b1da Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 1 Jun 2019 14:20:28 +0100 Subject: Don't default destructor Allows for use of plugin manager in other code (without full definition of contained types) --- libadhocutil/plugins.cpp | 2 ++ libadhocutil/plugins.h | 2 +- libadhocutil/unittests/testPlugins.cpp | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) 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 (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(); +} + BOOST_AUTO_TEST_CASE( get ) { auto implOfThingPlugin = PluginManager::getDefault()->get("ImplOfThing"); -- cgit v1.2.3