Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorLayer::Surface::CtorToken Class Reference

Opaque construction token — only SurfaceFactory can create instances of it. More...

#include <phosphor-layer/include/PhosphorLayer/Surface.h>

Detailed Description

Opaque construction token — only SurfaceFactory can create instances of it.

Required as the first parameter of Surface's constructor so direct construction (new Surface(...)) is impossible without going through SurfaceFactory::create / createAs<T>, which are the only paths that run the factory-wide validation (role well-formedness, screen fallback, sharedEngine+engineProvider mutual exclusion).

Subclasses wishing to be constructible via SurfaceFactory::createAs<T> accept a CtorToken as the first argument of their own constructor and forward it to the base. Consumer code cannot instantiate a CtorToken directly (private ctor, only friended to SurfaceFactory), so subclasses cannot bypass the factory even by exposing a public constructor of their own.


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