SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
controlruleprovider.h
Go to the documentation of this file.
1
28#ifndef OPENSWMMVIS_CONTROLS_CONTROLRULEPROVIDER_H
29#define OPENSWMMVIS_CONTROLS_CONTROLRULEPROVIDER_H
30
31#include <QObject>
32#include <QString>
33
35
38enum class ValidationState {
39 Pending = 0,
40 Valid = 1,
41 Invalid = 2
42};
43
44class ControlRuleProvider : public QObject
45{
46 Q_OBJECT
47
48public:
49 ControlRuleProvider(QString name, QString body, QObject *parent = nullptr);
51
52 // ── Identity ────────────────────────────────────────────────────────────
53
54 QString name() const noexcept { return m_name; }
55 QString body() const noexcept { return m_body; }
56
57 // ── Validation cache (set by the validator; read by the list model) ─────
58
59 ValidationState validationState() const noexcept { return m_validation; }
60 QString lastError() const noexcept { return m_lastError; }
61 int lastErrorLine() const noexcept { return m_lastErrorLine; }
62
63 // ── Mutators (registry-internal — UI code must go through the layer) ────
64
69 void setName(QString newName);
70
73 void setBody(QString newBody);
74
79 QString errorMessage = {},
80 int errorLine = -1);
81
82signals:
84 void nameChanged(QString prev, QString now);
85
88
91
92private:
93 QString m_name;
94 QString m_body;
96 QString m_lastError;
97 int m_lastErrorLine = -1;
98};
99
100} // namespace openswmmvis::controls
101
102#endif // OPENSWMMVIS_CONTROLS_CONTROLRULEPROVIDER_H
Definition controlruleprovider.h:45
void setBody(QString newBody)
Replace the full rule body (including the RULE <name> header). Resets validation to Pending so the va...
Definition controlruleprovider.cpp:28
void setName(QString newName)
Rename the rule. Uniqueness is the registry's responsibility; this just stores + notifies....
Definition controlruleprovider.cpp:20
void validationChanged()
Cached validation result changed.
QString body() const noexcept
Definition controlruleprovider.h:55
void nameChanged(QString prev, QString now)
Rule was renamed.
void setValidation(ValidationState state, QString errorMessage={}, int errorLine=-1)
Cache a validator verdict. Called by RuleValidator once Phase 6.8.2 is wired; the list model picks th...
Definition controlruleprovider.cpp:42
QString name() const noexcept
Definition controlruleprovider.h:54
QString lastError() const noexcept
Definition controlruleprovider.h:60
int lastErrorLine() const noexcept
Definition controlruleprovider.h:61
ValidationState validationState() const noexcept
Definition controlruleprovider.h:59
Definition controlruleprovider.h:34
ValidationState
Validator verdict for a rule body. Default Pending until the validator (Phase 6.8....
Definition controlruleprovider.h:38
@ Pending
Not yet validated (or sandbox engine missing).
@ Valid
Engine parser accepted the body.
@ Invalid
Engine parser rejected; see lastError().
QVector< int > parent
union-find
Definition pslgminsize.cpp:176