Wireshark 4.7.2
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
DisplayFilterValidator Class Reference

FilterValidator for Wireshark display filters. More...

#include <display_filter_validator.h>

Inheritance diagram for DisplayFilterValidator:
FilterValidator

Public Member Functions

 DisplayFilterValidator (QObject *parent=nullptr)
QValidator::State validate (QString &input, int &pos) const override
 Validates input and updates the stashed Detail.
Detail lastDetail () const override
 Returns the Detail produced by the most recent validate() call.
Public Member Functions inherited from FilterValidator
 FilterValidator (QObject *parent=nullptr)
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.

Additional Inherited Members

Static Public Member Functions inherited from FilterValidator
static QString createSyntaxErrorMessageFull (const QString &filter, const QString &err_msg, qsizetype loc_start, size_t loc_length)
 Builds a full, location-annotated error string.

Detailed Description

FilterValidator for Wireshark display filters.

validate() compiles the expression with dfilter_compile_full() and maps the result to the FilterEdit syntax states:

  • empty -> Acceptable (host shows Empty, no tint)
  • compiles cleanly -> Acceptable (Valid)
  • compiles with a warning or a deprecated token -> Acceptable with a non-empty Detail::deprecatedToken (host shows Deprecated/amber)
  • fails with DF_ERROR_UNEXPECTED_END -> Intermediate (still typing; never red)
  • fails otherwise -> Invalid, with the error message and location stashed in Detail so the host can render lastErrorFull().

Synchronous, like the capture validator: it runs on the host widget's debounce and reads lastDetail() immediately afterwards.

Member Function Documentation

◆ lastDetail()

Detail DisplayFilterValidator::lastDetail ( ) const
inlineoverridevirtual

Returns the Detail produced by the most recent validate() call.

Implements FilterValidator.

◆ validate()

QValidator::State DisplayFilterValidator::validate ( QString & input,
int & pos ) const
overridevirtual

Validates input and updates the stashed Detail.

Parameters
inputThe text to validate; may be normalised in place.
posIn/out cursor position.
Returns
Invalid, Intermediate, or Acceptable.

Implements FilterValidator.


The documentation for this class was generated from the following files: