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

Ordered list of AnimationAppRule entries with first-match resolver. More...

#include <phosphor-animation/include/PhosphorAnimation/AnimationAppRule.h>

Public Member Functions

 AnimationAppRuleList ()=default
 
int size () const noexcept
 
bool isEmpty () const noexcept
 
AnimationAppRule at (int index) const
 Random-access read.
 
QList< AnimationAppRuleentries () const
 
bool append (const AnimationAppRule &rule)
 Append rule.
 
void removeAt (int index)
 
void move (int from, int to)
 
void clear () noexcept
 
int setEntries (const QList< AnimationAppRule > &rules)
 Replace the entire list (used by setters that take a full already-built list, e.g.
 
std::optional< AnimationAppRuleresolveShader (const QString &windowClass, const QString &eventPath) const
 First matching Kind::Shader rule for the given (windowClass, eventPath).
 
std::optional< AnimationAppRuleresolveTiming (const QString &windowClass, const QString &eventPath) const
 First matching Kind::Timing rule for the given (windowClass, eventPath).
 
QJsonArray toJson () const
 
bool operator== (const AnimationAppRuleList &other) const noexcept
 
bool operator!= (const AnimationAppRuleList &other) const noexcept
 

Static Public Member Functions

static AnimationAppRuleList fromJson (const QJsonArray &arr)
 

Detailed Description

Ordered list of AnimationAppRule entries with first-match resolver.

The list is the storage shape — it preserves insertion order across round-trips so the user's drag-reorder choice survives. Resolution is O(N) per window event, which is fine for the expected rule count (dozens at most; the lookup happens once per window-lifecycle event, not per frame).

Constructor & Destructor Documentation

◆ AnimationAppRuleList()

PhosphorAnimationShaders::AnimationAppRuleList::AnimationAppRuleList ( )
default

Member Function Documentation

◆ append()

bool PhosphorAnimationShaders::AnimationAppRuleList::append ( const AnimationAppRule rule)

Append rule.

Returns true on success, false when the rule fails validation (empty classPattern or eventPath — "match every window" rules are silently dangerous, so the gate is mandatory). Callers writing UI flow can surface the rejection through the return value rather than re-checking after the call.

◆ at()

AnimationAppRule PhosphorAnimationShaders::AnimationAppRuleList::at ( int  index) const

Random-access read.

Out-of-range indices return a default- constructed AnimationAppRule (empty pattern + empty event) and log a warning — the empty fields cause the resolver short-circuits to skip the entry, so the worst observable effect is a "ghost" empty rule in any UI binding that doesn't itself bounds-check. Prefer entries() for iteration.

◆ clear()

void PhosphorAnimationShaders::AnimationAppRuleList::clear ( )
inlinenoexcept

◆ entries()

QList< AnimationAppRule > PhosphorAnimationShaders::AnimationAppRuleList::entries ( ) const
inline

◆ fromJson()

static AnimationAppRuleList PhosphorAnimationShaders::AnimationAppRuleList::fromJson ( const QJsonArray &  arr)
static

◆ isEmpty()

bool PhosphorAnimationShaders::AnimationAppRuleList::isEmpty ( ) const
inlinenoexcept

◆ move()

void PhosphorAnimationShaders::AnimationAppRuleList::move ( int  from,
int  to 
)

◆ operator!=()

bool PhosphorAnimationShaders::AnimationAppRuleList::operator!= ( const AnimationAppRuleList other) const
inlinenoexcept

◆ operator==()

bool PhosphorAnimationShaders::AnimationAppRuleList::operator== ( const AnimationAppRuleList other) const
inlinenoexcept

◆ removeAt()

void PhosphorAnimationShaders::AnimationAppRuleList::removeAt ( int  index)

◆ resolveShader()

std::optional< AnimationAppRule > PhosphorAnimationShaders::AnimationAppRuleList::resolveShader ( const QString &  windowClass,
const QString &  eventPath 
) const

First matching Kind::Shader rule for the given (windowClass, eventPath).

Match is substring case-insensitive on classPattern and exact on eventPath. Returns nullopt when no rule of that axis matches — the caller falls through to the per-event tree.

◆ resolveTiming()

std::optional< AnimationAppRule > PhosphorAnimationShaders::AnimationAppRuleList::resolveTiming ( const QString &  windowClass,
const QString &  eventPath 
) const

First matching Kind::Timing rule for the given (windowClass, eventPath).

Same matching rules as resolveShader.

◆ setEntries()

int PhosphorAnimationShaders::AnimationAppRuleList::setEntries ( const QList< AnimationAppRule > &  rules)

Replace the entire list (used by setters that take a full already-built list, e.g.

drag-reorder commits). Each entry is validated through the same gate as append() — entries with empty classPattern or eventPath are dropped rather than silently swallowing every window, and a warning is logged so the call-site bug is visible in the journal. Returns the number of entries actually accepted (so callers can detect drops).

◆ size()

int PhosphorAnimationShaders::AnimationAppRuleList::size ( ) const
inlinenoexcept

◆ toJson()

QJsonArray PhosphorAnimationShaders::AnimationAppRuleList::toJson ( ) const

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