2018-03-19 01:36:12 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QRegularExpression>
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class Filter
|
2018-03-19 01:36:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 12:51:05 +00:00
|
|
|
virtual ~Filter();
|
|
|
|
virtual bool accepts(const QString & value) = 0;
|
2018-03-19 01:36:12 +00:00
|
|
|
};
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class ContainsFilter: public Filter
|
2018-03-19 01:36:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 12:51:05 +00:00
|
|
|
ContainsFilter(const QString &pattern);
|
|
|
|
virtual ~ContainsFilter();
|
|
|
|
bool accepts(const QString & value) override;
|
2018-03-19 01:36:12 +00:00
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
QString pattern;
|
2018-03-19 01:36:12 +00:00
|
|
|
};
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class ExactFilter: public Filter
|
2018-03-19 01:36:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 12:51:05 +00:00
|
|
|
ExactFilter(const QString &pattern);
|
|
|
|
virtual ~ExactFilter();
|
|
|
|
bool accepts(const QString & value) override;
|
2018-03-19 01:36:12 +00:00
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
QString pattern;
|
2018-03-19 01:36:12 +00:00
|
|
|
};
|
|
|
|
|
2021-07-25 17:11:59 +00:00
|
|
|
class RegexpFilter: public Filter
|
2018-03-19 01:36:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-07-15 12:51:05 +00:00
|
|
|
RegexpFilter(const QString ®exp, bool invert);
|
|
|
|
virtual ~RegexpFilter();
|
|
|
|
bool accepts(const QString & value) override;
|
2018-03-19 01:36:12 +00:00
|
|
|
private:
|
2018-07-15 12:51:05 +00:00
|
|
|
QRegularExpression pattern;
|
|
|
|
bool invert = false;
|
2018-03-19 01:36:12 +00:00
|
|
|
};
|