64c591b234
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
53 lines
1.0 KiB
C++
53 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <QString>
|
|
#include <QRegularExpression>
|
|
|
|
class Filter
|
|
{
|
|
public:
|
|
virtual ~Filter();
|
|
virtual bool accepts(const QString & value) = 0;
|
|
};
|
|
|
|
class ContainsFilter: public Filter
|
|
{
|
|
public:
|
|
ContainsFilter(const QString &pattern);
|
|
virtual ~ContainsFilter();
|
|
bool accepts(const QString & value) override;
|
|
private:
|
|
QString pattern;
|
|
};
|
|
|
|
class ExactFilter: public Filter
|
|
{
|
|
public:
|
|
ExactFilter(const QString &pattern);
|
|
virtual ~ExactFilter();
|
|
bool accepts(const QString & value) override;
|
|
private:
|
|
QString pattern;
|
|
};
|
|
|
|
class ExactIfPresentFilter: public Filter
|
|
{
|
|
public:
|
|
ExactIfPresentFilter(const QString& pattern);
|
|
~ExactIfPresentFilter() override = default;
|
|
bool accepts(const QString& value) override;
|
|
private:
|
|
QString pattern;
|
|
};
|
|
|
|
class RegexpFilter: public Filter
|
|
{
|
|
public:
|
|
RegexpFilter(const QString ®exp, bool invert);
|
|
virtual ~RegexpFilter();
|
|
bool accepts(const QString & value) override;
|
|
private:
|
|
QRegularExpression pattern;
|
|
bool invert = false;
|
|
};
|