14#include "phosphorrules_export.h"
41 const QList<Rule>&
rules()
const
47 return m_rules.size();
51 return m_rules.isEmpty();
62 std::optional<Rule>
ruleById(
const QUuid&
id)
const;
97 static std::optional<RuleSet>
fromJson(
const QJsonObject& obj);
117 return m_rules == other.m_rules;
121 return !(*
this == other);
126 quint64 m_revision = 0;
quint64 revision() const
The monotonic revision — bumped on every mutating call.
Definition RuleSet.h:56
bool updateRule(const Rule &rule)
Replace the rule with the same id.
QJsonObject toJson() const
static std::optional< RuleSet > loadFromFile(const QString &path)
Load from path (an explicit file path — the library never derives config locations).
bool addRule(const Rule &rule)
Append a rule.
bool operator!=(const RuleSet &other) const
Definition RuleSet.h:119
std::optional< Rule > ruleById(const QUuid &id) const
The rule with id, or nullopt if not present.
static constexpr int SchemaVersion
The schema version this library reads and writes.
Definition RuleSet.h:36
bool operator==(const RuleSet &other) const
Equality compares the rule LIST only; revision is intentionally ignored.
Definition RuleSet.h:115
bool removeRule(const QUuid &id)
Remove the rule with id. Returns false if no such rule exists.
void clear()
Drop every rule.
bool saveToFile(const QString &path) const
Canonicalize-on-save: serialize and atomically write to path (temp-file + rename).
static std::optional< RuleSet > fromJson(const QJsonObject &obj)
Strict loader.
int setRules(const QList< Rule > &rules)
Replace the entire ordered rule list.
const QList< Rule > & rules() const
Definition RuleSet.h:41
bool isEmpty() const
Definition RuleSet.h:49
int count() const
Definition RuleSet.h:45
Definition ActionParams.h:25
One rule — { id, name, enabled, priority, match, actions, managed }.
Definition Rule.h:106