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
queryparser.h File Reference
#include <QList>
#include <QRegularExpression>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QVariantMap>
#include <memory>
Include dependency graph for queryparser.h:
This graph shows which files directly or indirectly include this file:

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)
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

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.