PrismLauncher/launcher/Filter.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.1 KiB
C
Raw Normal View History

2018-03-19 01:36:12 +00:00
#pragma once
#include <QRegularExpression>
#include <QString>
2018-03-19 01:36:12 +00:00
class Filter {
public:
2018-03-19 01:36:12 +00:00
virtual ~Filter();
virtual bool accepts(const QString& value) = 0;
2018-03-19 01:36:12 +00:00
};
class ContainsFilter : public Filter {
public:
ContainsFilter(const QString& pattern);
2018-03-19 01:36:12 +00:00
virtual ~ContainsFilter();
bool accepts(const QString& value) override;
private:
2018-03-19 01:36:12 +00:00
QString pattern;
};
class ExactFilter : public Filter {
public:
ExactFilter(const QString& pattern);
2018-03-19 01:36:12 +00:00
virtual ~ExactFilter();
bool accepts(const QString& value) override;
private:
2018-03-19 01:36:12 +00:00
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& regexp, bool invert);
2018-03-19 01:36:12 +00:00
virtual ~RegexpFilter();
bool accepts(const QString& value) override;
private:
2018-03-19 01:36:12 +00:00
QRegularExpression pattern;
bool invert = false;
};