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
rulesyntaxhighlighter.h
Go to the documentation of this file.
1
35#ifndef OPENSWMMVIS_CONTROLS_RULESYNTAXHIGHLIGHTER_H
36#define OPENSWMMVIS_CONTROLS_RULESYNTAXHIGHLIGHTER_H
37
38#include <QPalette>
39#include <QStringList>
40#include <QSyntaxHighlighter>
41#include <QTextCharFormat>
42
43namespace openswmmvis::controls {
44
45class RuleSyntaxHighlighter : public QSyntaxHighlighter
46{
47 Q_OBJECT
48
49public:
50 explicit RuleSyntaxHighlighter(QTextDocument *parent = nullptr);
52
56 void setPalette(const QPalette &palette);
57
58 // ── Vocabulary accessors — shared with the completer ────────────────
59
60 static QStringList blockKeywords();
61 static QStringList objectTypes();
62 static QStringList variableNames();
63 static QStringList operatorTokens();
64
69 static QStringList allKeywords();
70
71protected:
72 void highlightBlock(const QString &text) override;
73
74private:
75 void rebuildFormats_();
76
77 QPalette m_palette;
78
79 QTextCharFormat m_fmtBlockKw;
80 QTextCharFormat m_fmtObjectType;
81 QTextCharFormat m_fmtVariable;
82 QTextCharFormat m_fmtOperator;
83 QTextCharFormat m_fmtNumber;
84 QTextCharFormat m_fmtComment;
85};
86
87} // namespace openswmmvis::controls
88
89#endif // OPENSWMMVIS_CONTROLS_RULESYNTAXHIGHLIGHTER_H
Definition rulesyntaxhighlighter.h:46
void highlightBlock(const QString &text) override
Definition rulesyntaxhighlighter.cpp:123
static QStringList operatorTokens()
=, <, >, <=, >=, <>, IS
Definition rulesyntaxhighlighter.cpp:74
static QStringList variableNames()
DEPTH, HEAD, FLOW, VOLUME, INFLOW, SETTING, STATUS, CLOCKTIME, DATE, MONTH, DAY, TIME,...
Definition rulesyntaxhighlighter.cpp:72
static QStringList allKeywords()
Every keyword the completer can offer (block + object + variable). The completer's context-keyed pick...
Definition rulesyntaxhighlighter.cpp:80
static QStringList objectTypes()
NODE, LINK, CONDUIT, PUMP, ORIFICE, WEIR, OUTLET, SUBCATCH, SIMULATION, GAGE.
Definition rulesyntaxhighlighter.cpp:71
static QStringList blockKeywords()
RULE, IF, THEN, ELSE, AND, OR, NOT, PRIORITY.
Definition rulesyntaxhighlighter.cpp:70
void setPalette(const QPalette &palette)
Rebuild text formats from the supplied palette. Editor calls this whenever the application palette ch...
Definition rulesyntaxhighlighter.cpp:63
Definition controlruleprovider.h:34
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
QString text
Definition queryparser.cpp:35