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
Go to the documentation of this file.
1
34#ifndef OPENSWMMVIS_QUERYPARSER_H
35#define OPENSWMMVIS_QUERYPARSER_H
36
37#include <QList>
38#include <QRegularExpression>
39#include <QString>
40#include <QStringList>
41#include <QVariant>
42#include <QVariantMap>
43
44#include <memory>
45
46namespace openswmmvis {
47
49struct QueryNode {
59 std::shared_ptr<QueryNode> left;
60 std::shared_ptr<QueryNode> right;
61 QString fieldName;
62 QString op;
63 QVariant literal;
64 QList<QVariant> inList;
68 QRegularExpression likeRegex;
69};
70
74 std::shared_ptr<QueryNode> root;
75 QString error;
76 int errorPos = -1;
77 [[nodiscard]] bool isValid() const noexcept { return !!root && error.isEmpty(); }
78};
79
82QueryPredicate parseQuery(const QString &whereClause);
83
96QStringList queryFieldNames(const QueryPredicate &pred);
97
100bool evaluateQuery(const QueryPredicate &pred, const QVariantMap &row);
101
102} // namespace openswmmvis
103
104#endif // OPENSWMMVIS_QUERYPARSER_H
Definition aquiferprovider.h:21
QueryPredicate parseQuery(const QString &whereClause)
Definition queryparser.cpp:389
bool evaluateQuery(const QueryPredicate &pred, const QVariantMap &row)
Definition queryparser.cpp:394
QStringList queryFieldNames(const QueryPredicate &pred)
Definition queryparser.cpp:399
Definition queryparser.h:49
std::shared_ptr< QueryNode > right
Definition queryparser.h:60
QVariant literal
For Compare / Like.
Definition queryparser.h:63
QString op
For Compare: "<", "<=", ...
Definition queryparser.h:62
std::shared_ptr< QueryNode > left
Definition queryparser.h:59
QRegularExpression likeRegex
Definition queryparser.h:68
Kind kind
Definition queryparser.h:58
QString fieldName
Definition queryparser.h:61
QList< QVariant > inList
For In.
Definition queryparser.h:64
Kind
Definition queryparser.h:50
@ Like
Definition queryparser.h:55
@ AndOp
Definition queryparser.h:52
@ In
Definition queryparser.h:56
@ NotOp
Definition queryparser.h:53
@ Compare
Definition queryparser.h:54
@ OrOp
Definition queryparser.h:51
Definition queryparser.h:73
int errorPos
Definition queryparser.h:76
QString error
Definition queryparser.h:75
std::shared_ptr< QueryNode > root
Definition queryparser.h:74
bool isValid() const noexcept
Definition queryparser.h:77