PluginHost.h header
#include <ew/app/PluginHost.h>
Namespace ew::app
PluginHost class
class ew::app::PluginHost
Discovers and loads plugin shared libraries at startup (DESIGN.md section 6.11). For each file in a directory it QPluginLoader-loads the library, casts it to Plugin, checks the ABI level, and lets the plugin register its contributions into a ContributionRegistry. A bad file (not a Qt plugin, wrong interface/IID, incompatible ABI, or a Qt/compiler build-key mismatch) is skipped with its reason recorded – one bad plugin never aborts the scan or crashes the app. Loaded libraries are kept resident for the app's lifetime. GUI/main-thread only.
Members
ew::app::PluginHost::PluginHost()
Constructs a plugin host with nothing loaded yet.
ew::app::PluginHost::~PluginHost()
Destroys the host; the loaded plugin libraries it kept resident are released.
ew::app::PluginHost::PluginHost(const PluginHost &)=delete
Not copyable.
ew::app::PluginHost::PluginHost(PluginHost &&)=delete
Not movable.
PluginHost & ew::app::PluginHost::operator=(const PluginHost &)=delete
Not copyable.
PluginHost & ew::app::PluginHost::operator=(PluginHost &&)=delete
Not movable.
void ew::app::PluginHost::loadFrom(const QString &directory, ContributionRegistry ®istry)
Scans directory (non-recursively) for plugin libraries and registers each valid plugin's contributions into registry. Safe on a missing or empty directory (records nothing). Appends to records, so results accumulate across several calls.
const std::vector< PluginLoadRecord > & ew::app::PluginHost::records() const
The per-file diagnostics from every loadFrom call, for the Preferences plugins page.
PluginLoadRecord struct
struct ew::app::PluginLoadRecord
The outcome of examining one file in the plugins directory: which file, whether it loaded as a valid plugin, its identity when it did, and a human-readable reason when it did not.
Members
QString ew::app::PluginLoadRecord::fileName
The file examined (base name, for display).
bool ew::app::PluginLoadRecord::loaded = false
True when the file loaded, passed the ABI check, and registered its contributions.
PluginMetadata ew::app::PluginLoadRecord::metadata
The plugin's reported identity; meaningful only when loaded is true.
QString ew::app::PluginLoadRecord::error
Why the file was skipped (loader error, interface mismatch, or ABI mismatch); empty on success.
Functions
std::optional< QString > ew::app::registerPlugin(Plugin &plugin, ContributionRegistry ®istry)
Validates plugin's ABI level and, when it matches kPluginAbiVersion, calls registerContributions(registry). Returns std::nullopt on success, or a human-readable error when the ABI level is incompatible. The pure core of PluginHost::loadFrom, testable with a fake Plugin and no QPluginLoader.