![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
#include <QList>#include <QRegularExpression>#include <QString>#include <QStringList>#include <QVariant>#include <QVariantMap>#include <memory>Go to the source code of this file.
Classes | |
| struct | openswmmvis::QueryNode |
| struct | openswmmvis::QueryPredicate |
Namespaces | |
| namespace | openswmmvis |
Functions | |
| QueryPredicate | openswmmvis::parseQuery (const QString &whereClause) |
| QStringList | openswmmvis::queryFieldNames (const QueryPredicate &pred) |
| bool | openswmmvis::evaluateQuery (const QueryPredicate &pred, const QVariantMap &row) |
Slice Z.2 — Tiny SQL-like WHERE-clause parser for the Attribute Table's filter bar. Hand-rolled; no SQLite or other dependency.
Grammar (recursive descent, AND binds tighter than OR):
where := orExpr orExpr := andExpr { 'OR' andExpr } andExpr := notExpr { 'AND' notExpr } notExpr := 'NOT' notExpr | primary primary := '(' orExpr ')' | comparison comparison := ident op value | ident 'LIKE' string | ident 'IN' '(' value { ',' value } ')' op := '<' | '<=' | '=' | '!=' | '>' | '>=' ident := bare-identifier | '[' anything-but-]+ ']' | '"' …'"' value := number | quoted-string
Keywords AND / OR / NOT / LIKE / IN are case-insensitive. Identifier matching against row keys is case-sensitive because the column schema keys are themselves (e.g. "Invert elev" vs "invert_elev").
The evaluator runs against a QVariantMap (one row's identify-map), comparing values type-aware: numeric vs string coercion follows QVariant's rules.