irccd
3.0.3
|
Abstract interface for searching plugins. More...
#include <plugin.hpp>
Public Member Functions | |
plugin_loader (std::vector< std::string > directories={}, std::vector< std::string > extensions={}) noexcept | |
virtual | ~plugin_loader ()=default |
virtual auto | is_supported (std::string_view path) noexcept -> bool |
virtual auto | open (std::string_view id, std::string_view file) -> std::shared_ptr< plugin >=0 |
virtual auto | find (std::string_view id) -> std::shared_ptr< plugin > |
Abstract interface for searching plugins.
This class is used to make loading of plugins extensible, the plugin_service knows some predefined plugins loaders and use them to search for available plugins.
This makes easier to implement new plugins or new ways of loading them.
|
noexcept |
Construct the loader with a predefined set of directories and extensions.
If directories is not specified, a sensible default list of system and user paths are searched.
directories | optional list of directories to search |
extensions | optional list of extensions |
|
virtualdefault |
Virtual destructor defaulted.
Reimplemented in irccd::js::plugin_loader.
|
virtual |
Search for a plugin named by this id.
id | the plugin id |
plugin_error | on errors |
Reimplemented in irccd::test::test_plugin_loader.
|
virtualnoexcept |
Tells if the plugin should be opened by checking file extension.
path | the path |
|
pure virtual |
Try to open the plugin specified by path.
The implementation must test if the plugin is suitable for opening, by testing extension for example.
id | the plugin identifier |
file | the file path |
plugin_error | on errors |
Implemented in irccd::daemon::dynlib_plugin_loader, irccd::test::test_plugin_loader, and irccd::js::plugin_loader.