| Wireshark 4.7.3 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
31 class FilterValidator : public QValidator
32{
33 Q_OBJECT
34
35 public:
39 struct Detail {
40 int errPos = -1;
41 int errLen = 0;
42 QString errMsg;
43 QString deprecatedToken;
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
FilterValidator::createSyntaxErrorMessageFull
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
FilterValidator::lastError
QString lastError() const
Short error message from the last validation (Detail::errMsg).
Definition filter_validator.h:62
FilterValidator::deprecatedToken
QString deprecatedToken() const
The deprecated token from the last validation, or empty.
Definition filter_validator.h:73
FilterValidator::lastErrorFull
QString lastErrorFull(const QString &filter) const
Full, location-annotated error message for filter.
Definition filter_validator.cpp:19
FilterValidator::lastDetail
virtual Detail lastDetail() const =0
Returns the Detail produced by the most recent validate() call.
FilterValidator::validate
QValidator::State validate(QString &input, int &pos) const override=0
Validates input and updates the stashed Detail.
FilterValidator::Detail
Diagnostic detail produced by the most recent validate() call.
Definition filter_validator.h:39
FilterValidator::Detail::errPos
int errPos
Definition filter_validator.h:40
FilterValidator::Detail::errMsg
QString errMsg
Definition filter_validator.h:42
FilterValidator::Detail::deprecatedToken
QString deprecatedToken
Definition filter_validator.h:43
FilterValidator::Detail::errLen
int errLen
Definition filter_validator.h:41
input
Definition tvbuff_lz77huff.c:32