Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorLayout::ILayoutSourceFactory Class Referenceabstract

Abstract factory for an ILayoutSource implementation. More...

#include <phosphor-layout-api/include/PhosphorLayoutApi/ILayoutSourceFactory.h>

Inheritance diagram for PhosphorLayout::ILayoutSourceFactory:
[legend]

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< ILayoutSourcecreate ()=0
 Build a fresh source instance. Caller takes ownership.
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ ~ILayoutSourceFactory()

PhosphorLayout::ILayoutSourceFactory::~ILayoutSourceFactory ( )
override

Member Function Documentation

◆ create()

virtual std::unique_ptr< ILayoutSource > PhosphorLayout::ILayoutSourceFactory::create ( )
pure virtual

Build a fresh source instance. Caller takes ownership.

Implemented in PhosphorTiles::AutotileLayoutSourceFactory, and PhosphorZones::ZonesLayoutSourceFactory.

◆ displayName()

QString PhosphorLayout::ILayoutSourceFactory::displayName ( ) const
inlineoverride

◆ id()

QString PhosphorLayout::ILayoutSourceFactory::id ( ) const
inlineoverride

IFactoryBase: both the registry key and the UI label are the provider name (a layout source has a single identity).

◆ name()

virtual QString PhosphorLayout::ILayoutSourceFactory::name ( ) const
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.


The documentation for this class was generated from the following file: