Wireshark 4.7.2
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
filter_validator.h
Go to the documentation of this file.
1
9
10#ifndef FILTER_VALIDATOR_H
11#define FILTER_VALIDATOR_H
12
13#include <QValidator>
14#include <QString>
15
31class FilterValidator : public QValidator
32{
33 Q_OBJECT
34
35public:
39 struct Detail {
40 int errPos = -1;
41 int errLen = 0;
42 QString errMsg;
44 };
45
46 explicit FilterValidator(QObject *parent = nullptr);
47
54 QValidator::State validate(QString &input, int &pos) const override = 0;
55
59 virtual Detail lastDetail() const = 0;
60
62 QString lastError() const { return lastDetail().errMsg; }
63
70 QString lastErrorFull(const QString &filter) const;
71
73 QString deprecatedToken() const { return lastDetail().deprecatedToken; }
74
82 static QString createSyntaxErrorMessageFull(const QString &filter,
83 const QString &err_msg,
84 qsizetype loc_start,
85 size_t loc_length);
86};
87
88#endif // FILTER_VALIDATOR_H
static QString createSyntaxErrorMessageFull(const QString &filter, const QString &err_msg, qsizetype loc_start, size_t loc_length)
Builds a full, location-annotated error string.
Definition filter_validator.cpp:29
QString lastError() const
Short error message from the last validation (Detail::errMsg).
Definition filter_validator.h:62
QString deprecatedToken() const
The deprecated token from the last validation, or empty.
Definition filter_validator.h:73
QString lastErrorFull(const QString &filter) const
Full, location-annotated error message for filter.
Definition filter_validator.cpp:19
virtual Detail lastDetail() const =0
Returns the Detail produced by the most recent validate() call.
QValidator::State validate(QString &input, int &pos) const override=0
Validates input and updates the stashed Detail.
Diagnostic detail produced by the most recent validate() call.
Definition filter_validator.h:39
int errPos
Definition filter_validator.h:40
QString errMsg
Definition filter_validator.h:42
QString deprecatedToken
Definition filter_validator.h:43
int errLen
Definition filter_validator.h:41
Definition tvbuff_lz77huff.c:32