From 075085212ba33c8c9cfe7a8a5004cf2524662e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 10 Jan 2015 12:53:52 +0100 Subject: [PATCH] doc: slightly more convenient plugin loading. Less typing and less name duplication, but hides the actual load error from the user. The error is printed on stdout anyway and the user doesn't care anyway in 90% cases. --- doc/plugins.dox | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/plugins.dox b/doc/plugins.dox index 420f36794..2eae069b4 100644 --- a/doc/plugins.dox +++ b/doc/plugins.dox @@ -129,12 +129,12 @@ lifetime of all plugin instances created from it. // ... { - PluginManager::Manager manager(MAGNUM_PLUGINS_IMPORTER_DIR); - if(!(manager.load("TgaImporter") & PluginManager::LoadState::Loaded)) { - Error() << "Cannot load TgaImporter plugin from" << manager.pluginDirectory(); + PluginManager::Manager manager{MAGNUM_PLUGINS_IMPORTER_DIR}; + std::unique_ptr tgaImporter = manager.loadAndInstantiate("TgaImporter"); + if(!tgaImporter) { + Error() << "Cannot load importer plugin from" << manager.pluginDirectory(); std::exit(1); } - std::unique_ptr tgaImporter = manager.instance("TgaImporter"); // Use the plugin...