|
Wireshark 4.7.3
The Wireshark network protocol analyzer
|
Abstract QValidator for filter expressions, attachable to any QLineEdit. More...
#include <filter_validator.h>
Classes | |
| struct | Detail |
| Diagnostic detail produced by the most recent validate() call. More... | |
Public Member Functions | |
| FilterValidator (QObject *parent=nullptr) | |
| QValidator::State | validate (QString &input, int &pos) const override=0 |
Validates input and updates the stashed Detail. | |
| virtual Detail | lastDetail () const =0 |
| Returns the Detail produced by the most recent validate() call. | |
| QString | lastError () const |
| Short error message from the last validation (Detail::errMsg). | |
| QString | lastErrorFull (const QString &filter) const |
Full, location-annotated error message for filter. | |
| QString | deprecatedToken () const |
| The deprecated token from the last validation, or empty. | |
Static Public Member Functions | |
| static QString | createSyntaxErrorMessageFull (const QString &filter, const QString &err_msg, qsizetype loc_start, size_t loc_length) |
| Builds a full, location-annotated error string. | |
Abstract QValidator for filter expressions, attachable to any QLineEdit.
Plain QValidator is insufficient for filter editing: its State is only Invalid/Intermediate/Acceptable and it carries no error text, error location, or deprecation information. FilterValidator extends it with a Detail accessor that the host widget reads immediately after calling validate().
The validator is intended to be single-owner: each instance is permanently attached to one widget, so the "validate() then read lastDetail()" stash-and-read pattern is safe and non-reentrant.
Subclasses (DisplayFilterValidator, CaptureFilterValidator) implement validate() against their respective compilers and return matching Detail.
|
static |
Builds a full, location-annotated error string.
| filter | The expression that failed validation. |
| err_msg | Short error message. |
| loc_start | Zero-based offset where the error begins. |
| loc_length | Number of characters the error spans. |
|
pure virtual |
Returns the Detail produced by the most recent validate() call.
Implemented in CaptureFilterValidator, and DisplayFilterValidator.
| QString FilterValidator::lastErrorFull | ( | const QString & | filter | ) | const |
Full, location-annotated error message for filter.
Combines the expression with a caret/underline marking the error span reported in lastDetail(). Returns an empty string when there is no error.
|
overridepure virtual |
Validates input and updates the stashed Detail.
| input | The text to validate; may be normalised in place. |
| pos | In/out cursor position. |
Implemented in CaptureFilterValidator, and DisplayFilterValidator.