Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorRules::ActionRegistry Class Reference

Process-wide registry of action descriptors. More...

#include <PhosphorRules/RuleAction.h>

Public Member Functions

void registerAction (const ActionDescriptor &descriptor)
 Register (or replace) a descriptor.
bool unregisterAction (const QString &type)
 Remove a previously-registered descriptor.
bool isRegistered (const QString &type) const
 True if type names a registered action.
std::optional< ActionDescriptor > descriptor (const QString &type) const
 The descriptor for type, or nullopt if unregistered.
QString slotFor (const RuleAction &action) const
 The slot a concrete action resolves to, or an empty string if the type is unregistered or its descriptor rejects the params.
bool isTerminal (const RuleAction &action) const
 True if action is a terminal action (one of the Exclude family).
bool validate (const RuleAction &action) const
 True if action passes its descriptor's validation.
ActionDomain domainFor (const RuleAction &action) const
 The evaluation domain action contributes to, or ActionDomain::Window for an unregistered type (the conservative default — window evaluation is the broader query shape, so an unknown action gets the looser compatibility check rather than being silently flagged as a context mismatch).
QStringList registeredTypes () const
 All registered type ids — for UI enumeration / tests.
bool hasTag (const QString &type, QLatin1StringView tag) const
 True if the descriptor for type carries tag.
QStringList typesWithTag (QLatin1StringView tag) const
 All registered type ids whose descriptor carries tag.
QString paramKeyOfKind (const QString &type, QLatin1StringView kind) const
 The wire param key whose schema kind is kind for type, or an empty string when type declares no such param (including an unregistered type).

Static Public Member Functions

static ActionRegistry & instance ()
 The shared process-wide registry, pre-populated with the built-ins.

Detailed Description

Process-wide registry of action descriptors.

The built-in descriptors register on first access via instance(). The registry is the single source of truth for an action's slot, validation, and terminal flag — RuleAction, RuleEvaluator, and the loaders all consult it.

Member Function Documentation

◆ descriptor()

std::optional< ActionDescriptor > PhosphorRules::ActionRegistry::descriptor ( const QString & type) const

The descriptor for type, or nullopt if unregistered.

◆ domainFor()

ActionDomain PhosphorRules::ActionRegistry::domainFor ( const RuleAction & action) const

The evaluation domain action contributes to, or ActionDomain::Window for an unregistered type (the conservative default — window evaluation is the broader query shape, so an unknown action gets the looser compatibility check rather than being silently flagged as a context mismatch).

◆ hasTag()

bool PhosphorRules::ActionRegistry::hasTag ( const QString & type,
QLatin1StringView tag ) const

True if the descriptor for type carries tag.

◆ instance()

ActionRegistry & PhosphorRules::ActionRegistry::instance ( )
static

The shared process-wide registry, pre-populated with the built-ins.

◆ isRegistered()

bool PhosphorRules::ActionRegistry::isRegistered ( const QString & type) const

True if type names a registered action.

◆ isTerminal()

bool PhosphorRules::ActionRegistry::isTerminal ( const RuleAction & action) const

True if action is a terminal action (one of the Exclude family).

◆ paramKeyOfKind()

QString PhosphorRules::ActionRegistry::paramKeyOfKind ( const QString & type,
QLatin1StringView kind ) const

The wire param key whose schema kind is kind for type, or an empty string when type declares no such param (including an unregistered type).

Lets a consumer ask a STRUCTURAL question about an action — "is this one scoped to an animation event?" — without maintaining its own list of type ids. A consumer that hardcodes such a list drifts silently the day a fourth action of the same shape is registered; this reads the same descriptor the editor renders from, so it cannot.

The first match wins. No descriptor declares two params of one kind.

◆ registerAction()

void PhosphorRules::ActionRegistry::registerAction ( const ActionDescriptor & descriptor)

Register (or replace) a descriptor.

Used by the built-ins and by future-phase consumers that add new action types.

◆ registeredTypes()

QStringList PhosphorRules::ActionRegistry::registeredTypes ( ) const

All registered type ids — for UI enumeration / tests.

◆ slotFor()

QString PhosphorRules::ActionRegistry::slotFor ( const RuleAction & action) const

The slot a concrete action resolves to, or an empty string if the type is unregistered or its descriptor rejects the params.

◆ typesWithTag()

QStringList PhosphorRules::ActionRegistry::typesWithTag ( QLatin1StringView tag) const

All registered type ids whose descriptor carries tag.

◆ unregisterAction()

bool PhosphorRules::ActionRegistry::unregisterAction ( const QString & type)

Remove a previously-registered descriptor.

Returns true if type was present and removed, false otherwise. Counterpart to registerAction so tests / future consumers can symmetrically undo a registration (without it, every test-time sentinel would leak into the process-wide singleton for the remainder of the test binary's lifetime).

◆ validate()

bool PhosphorRules::ActionRegistry::validate ( const RuleAction & action) const

True if action passes its descriptor's validation.


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