Abstract factory for an ILayoutSource implementation.
More...
#include <phosphor-layout-api/include/PhosphorLayoutApi/ILayoutSourceFactory.h>
Public Member Functions | |
| ~ILayoutSourceFactory () override | |
| virtual QString | name () const =0 |
| Stable identifier for diagnostics / logging. | |
| QString | id () const override |
| IFactoryBase: both the registry key and the UI label are the provider name (a layout source has a single identity). | |
| QString | displayName () const override |
| virtual std::unique_ptr< ILayoutSource > | create ()=0 |
| Build a fresh source instance. Caller takes ownership. | |
Abstract factory for an ILayoutSource implementation.
Each provider library (phosphor-zones, phosphor-tiles, future phosphor-scrolling, third-party plugins) ships a concrete factory alongside its ILayoutSource implementation. The factory carries whatever provider-specific construction arguments the source requires (e.g. a borrowed registry pointer). Calling create hands the caller a fresh source instance bound to those arguments.
LayoutSourceBundle keeps its factories in a PhosphorRegistry::Registry<ILayoutSourceFactory> (the shared id-keyed store) and assembles a composite of every produced source. Composition roots register factories — adding a new layout-source family (the upcoming scrolling engine) is then one addFactory() line at each root, with no edits to phosphor-layout-api or to the bundle.
Derives IFactoryBase so the factory is a first-class registry entry: id() / displayName() both delegate to name() (a layout-source provider has one identity), and capabilities() uses the default empty list. Concrete providers therefore still implement only name() and create() — nothing changes for them.
Factory contract: the same create() call must be safe to invoke repeatedly and from any thread the caller chooses; concrete factories are responsible for any thread-safety in their stored arguments. Returned sources are heap-owned by the caller (typically via std::unique_ptr).
|
override |
|
pure virtual |
Build a fresh source instance. Caller takes ownership.
Implemented in PhosphorTiles::AutotileLayoutSourceFactory, and PhosphorZones::ZonesLayoutSourceFactory.
|
inlineoverride |
|
inlineoverride |
IFactoryBase: both the registry key and the UI label are the provider name (a layout source has a single identity).
|
pure virtual |
Stable identifier for diagnostics / logging.
Should match the provider library name (e.g. "zones", "autotile", "scrolling"). This is also the registry key — id() returns it.
Implemented in PhosphorTiles::AutotileLayoutSourceFactory, and PhosphorZones::ZonesLayoutSourceFactory.