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

One action carried by a Rule. More...

#include <PhosphorRules/RuleAction.h>

Public Member Functions

bool operator== (const RuleAction &other) const
bool operator!= (const RuleAction &other) const
QJsonObject toJson () const

Static Public Member Functions

static std::optional< RuleAction > fromJson (const QJsonObject &obj)
 Strict loader — validates against the ActionRegistry; returns nullopt for an unregistered type or params that fail descriptor validation.

Public Attributes

QString type
 registered action type id (e.g.
QJsonObject params
 Action-specific payload.

Detailed Description

One action carried by a Rule.

A RuleAction is a { type, params } pair. The type selects an ActionDescriptor in the ActionRegistry; the descriptor maps the action to a slot and validates/serializes its params.

Conflict resolution during evaluation is first-matching-rule-wins per slot — actions in different slots stack, actions in the same slot do not. Some action types compute their slot from a params field (the animation actions are scoped by their event), so the slot is resolved through the registry rather than stored on the action.

Member Function Documentation

◆ fromJson()

std::optional< RuleAction > PhosphorRules::RuleAction::fromJson ( const QJsonObject & obj)
static

Strict loader — validates against the ActionRegistry; returns nullopt for an unregistered type or params that fail descriptor validation.

◆ operator!=()

bool PhosphorRules::RuleAction::operator!= ( const RuleAction & other) const
inline

◆ operator==()

bool PhosphorRules::RuleAction::operator== ( const RuleAction & other) const
inline

◆ toJson()

QJsonObject PhosphorRules::RuleAction::toJson ( ) const

Member Data Documentation

◆ params

QJsonObject PhosphorRules::RuleAction::params

Action-specific payload.

NOTE: "type" is a reserved param key — toJson() writes type inline alongside params, so a params entry keyed "type" is clobbered on serialization (and stripped on load). A free-form acceptAny action must not use "type" as a payload key. action-specific payload

◆ type

QString PhosphorRules::RuleAction::type

registered action type id (e.g.

ActionType::SetEngineMode)


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