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< AnimationAppRule > | entries () 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< AnimationAppRule > | resolveShader (const QString &windowClass, const QString &eventPath) const |
First matching Kind::Shader rule for the given (windowClass, eventPath). | |
| std::optional< AnimationAppRule > | resolveTiming (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) |
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).
|
default |
| 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.
| 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.
|
inlinenoexcept |
|
inline |
|
static |
|
inlinenoexcept |
| void PhosphorAnimationShaders::AnimationAppRuleList::move | ( | int | from, |
| int | to | ||
| ) |
|
inlinenoexcept |
|
inlinenoexcept |
| void PhosphorAnimationShaders::AnimationAppRuleList::removeAt | ( | int | index | ) |
| 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.
| 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.
| 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).
|
inlinenoexcept |
| QJsonArray PhosphorAnimationShaders::AnimationAppRuleList::toJson | ( | ) | const |