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

One rule — { id, name, enabled, priority, match, actions, managed }. More...

#include <PhosphorRules/Rule.h>

Public Member Functions

bool isValid () const
 True if the rule has a non-null id, a valid match expression, and every action validates against the registry.
bool hasTerminalAction () const
 True if any of this rule's actions is terminal (one of the Exclude family — Exclude / ExcludePlacement / ExcludeAnimations / ExcludeDecorations).
QList< ValidationIssue > validationIssues () const
 Semantic compatibility issues between match and each action.
bool operator== (const Rule &other) const
bool operator!= (const Rule &other) const
QJsonObject toJson () const

Static Public Member Functions

static std::optional< Rule > fromJson (const QJsonObject &obj)
 Strict loader — drops the rule (returns nullopt) on a missing/invalid id, a malformed match expression, or if every action fails to load.

Public Attributes

QUuid id
QString name
bool enabled = true
int priority = 0
MatchExpression match
 default-constructs to the catch-all All{}
QList< RuleAction > actions
bool managed = false
 True for built-in rules the application owns rather than the user (currently the baseline appearance rule).

Detailed Description

One rule — { id, name, enabled, priority, match, actions, managed }.

A copyable value type living inside RuleSet's ordered list. The id is a stable QUuid (serialized toString() with braces). priority orders evaluation: higher priority is evaluated first; ties break by the rule set's list order.

Member Function Documentation

◆ fromJson()

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

Strict loader — drops the rule (returns nullopt) on a missing/invalid id, a malformed match expression, or if every action fails to load.

Individual malformed actions are dropped with a logged diagnostic.

◆ hasTerminalAction()

bool PhosphorRules::Rule::hasTerminalAction ( ) const

True if any of this rule's actions is terminal (one of the Exclude family — Exclude / ExcludePlacement / ExcludeAnimations / ExcludeDecorations).

◆ isValid()

bool PhosphorRules::Rule::isValid ( ) const

True if the rule has a non-null id, a valid match expression, and every action validates against the registry.

◆ operator!=()

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

◆ operator==()

bool PhosphorRules::Rule::operator== ( const Rule & other) const

◆ toJson()

QJsonObject PhosphorRules::Rule::toJson ( ) const

◆ validationIssues()

QList< ValidationIssue > PhosphorRules::Rule::validationIssues ( ) const

Semantic compatibility issues between match and each action.

Distinct from isValid — that one is the structural check (registry-known type, well-formed params). This pass cross-checks the action's ActionDomain against the match expression's domain and surfaces combinations that compile and load but silently never fire.

Produces three codes:

An empty list means no issues — the rule is well-formed at both layers.

Member Data Documentation

◆ actions

QList<RuleAction> PhosphorRules::Rule::actions

◆ enabled

bool PhosphorRules::Rule::enabled = true

◆ id

QUuid PhosphorRules::Rule::id

◆ managed

bool PhosphorRules::Rule::managed = false

True for built-in rules the application owns rather than the user (currently the baseline appearance rule).

Managed rules are seeded and kept present by the store, are non-deletable and non-reorderable in the settings UI, and are pinned to lowest precedence so any user rule overrides them. The flag is metadata only — evaluation treats a managed rule like any other; the UI and store layers enforce the lifecycle.

◆ match

MatchExpression PhosphorRules::Rule::match

default-constructs to the catch-all All{}

◆ name

QString PhosphorRules::Rule::name

◆ priority

int PhosphorRules::Rule::priority = 0

The documentation for this struct was generated from the following file:
  • phosphor-rules/include/PhosphorRules/Rule.h