Plugin.h header
#include <ew/app/Plugin.h>
Namespace ew::app
Plugin class
class ew::app::Plugin
The extension seam every Easy Writer plugin implements (DESIGN.md section 6.11). A plugin is a separate shared library the host discovers and loads at startup; on load it declares its ABI level and identity and, through a host-supplied PluginContext, registers the contributions it adds (for the first ABI: colour themes and AI commands – both pure data). The interface is deliberately not a QObject: the concrete plugin class is the QObject (via Q_PLUGIN_METADATA and Q_INTERFACES), which keeps this contract a plain vtable plus value types, safe across the DLL/ABI boundary.
Thread affinity: the host constructs and calls a plugin on the GUI/main thread during startup. Contract: no method may throw across the boundary (CODING_STANDARDS.md section 6.5) – report failure by registering nothing.
Members
ew::app::Plugin::Plugin()=default
Defaulted.
virtual ew::app::Plugin::~Plugin()=default
Defaulted.
ew::app::Plugin::Plugin(const Plugin &)=delete
Not copyable.
ew::app::Plugin::Plugin(Plugin &&)=delete
Not movable.
Plugin & ew::app::Plugin::operator=(const Plugin &)=delete
Not copyable.
Plugin & ew::app::Plugin::operator=(Plugin &&)=delete
Not movable.
virtual int ew::app::Plugin::abiVersion() const =0
The ABI level this plugin was built against; the host rejects the plugin unless this equals kPluginAbiVersion. Implement as return ew::app::kPluginAbiVersion;.
virtual PluginMetadata ew::app::Plugin::metadata() const =0
The plugin's identity, for display and diagnostics. Called once, right after a successful ABI check.
virtual void ew::app::Plugin::registerContributions(PluginContext &context)=0
Registers every contribution this plugin provides by calling context's add* methods. The host calls this exactly once per session, after the ABI check passes. Must not throw.
PluginMetadata struct
struct ew::app::PluginMetadata
Identity a plugin reports about itself, shown in Preferences and used to key load diagnostics. All fields are plugin-authored; id is a stable reverse-DNS token, the rest are display text.
Members
QString ew::app::PluginMetadata::id
Stable machine id, reverse-DNS (e.g. "games.loomwright.noir-theme-pack").
QString ew::app::PluginMetadata::name
Human display name (e.g. "Noir Theme Pack").
QString ew::app::PluginMetadata::version
Plugin version, free-form but conventionally semantic (e.g. "1.2.0").
QString ew::app::PluginMetadata::author
Author or vendor, for display and attribution.
QString ew::app::PluginMetadata::description
One-line description of what the plugin contributes.
Constants
int ew::app::kPluginAbiVersion = 2
The plugin ABI level this build supports. The host loads a plugin only when the plugin's Plugin::abiVersion equals this value. Bump it – and the "/N" suffix of EW_PLUGIN_IID in lockstep – on any incompatible change to the Plugin or PluginContext vtable, so a plugin built against a different ABI is cleanly rejected instead of mis-called.