11#include "phosphorrules_export.h"
47class PHOSPHORRULES_EXPORT
RuleStore :
public QObject
76 return m_ruleSet.count();
82 return m_ruleSet.ruleById(
id).has_value();
An ordered collection of Rules — the persistent rule store.
Definition RuleSet.h:33
QString filePath() const
The backing file path.
Definition RuleStore.h:62
void load()
(Re)load from disk.
void rulesChanged(bool persisted)
Emitted whenever the in-memory rule set changes (load or any mutator).
bool contains(const QUuid &id) const
True if a rule with id is present.
Definition RuleStore.h:80
bool setRuleEnabled(const QUuid &id, bool enabled)
Set the enabled flag of the rule with id.
int count() const
Number of rules in the store.
Definition RuleStore.h:74
bool updateRule(const Rule &rule)
Replace the rule with the same id.
const RuleSet & ruleSet() const
Read-only access to the live rule set.
Definition RuleStore.h:68
bool addRule(const Rule &rule)
Append a rule.
~RuleStore() override=default
bool setRulePriority(const QUuid &id, int priority)
Set the priority of the rule with id.
bool removeRule(const QUuid &id)
Remove the rule with id.
bool save()
Persist the in-memory set to disk (atomic temp-write + rename).
bool setAllRules(const QList< Rule > &rules)
Replace the entire rule list.
RuleStore(const QString &filePath, QObject *parent=nullptr)
Definition ActionParams.h:25
One rule — { id, name, enabled, priority, match, actions, managed }.
Definition Rule.h:106