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