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. | |
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.
| std::optional< ActionDescriptor > PhosphorRules::ActionRegistry::descriptor | ( | const QString & | type | ) | const |
The descriptor for type, or nullopt if unregistered.
| 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).
| bool PhosphorRules::ActionRegistry::hasTag | ( | const QString & | type, |
| QLatin1StringView | tag ) const |
True if the descriptor for type carries tag.
|
static |
The shared process-wide registry, pre-populated with the built-ins.
| bool PhosphorRules::ActionRegistry::isRegistered | ( | const QString & | type | ) | const |
True if type names a registered action.
| bool PhosphorRules::ActionRegistry::isTerminal | ( | const RuleAction & | action | ) | const |
True if action is a terminal action (one of the Exclude family).
| 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.
| 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.
| QStringList PhosphorRules::ActionRegistry::registeredTypes | ( | ) | const |
All registered type ids — for UI enumeration / tests.
| 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.
| QStringList PhosphorRules::ActionRegistry::typesWithTag | ( | QLatin1StringView | tag | ) | const |
All registered type ids whose descriptor carries tag.
| 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).
| bool PhosphorRules::ActionRegistry::validate | ( | const RuleAction & | action | ) | const |
True if action passes its descriptor's validation.