summaryrefslogtreecommitdiffstats
path: root/api/logic/Filter.h
blob: 8de7d8f9e5c7a9f282cacd55c5f64aec2d5e4458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once

#include <QString>
#include <QRegularExpression>

#include "multimc_logic_export.h"

class MULTIMC_LOGIC_EXPORT Filter
{
public:
	virtual ~Filter();
	virtual bool accepts(const QString & value) = 0;
};

class MULTIMC_LOGIC_EXPORT ContainsFilter: public Filter
{
public:
	ContainsFilter(const QString &pattern);
	virtual ~ContainsFilter();
	bool accepts(const QString & value) override;
private:
	QString pattern;
};

class MULTIMC_LOGIC_EXPORT ExactFilter: public Filter
{
public:
	ExactFilter(const QString &pattern);
	virtual ~ExactFilter();
	bool accepts(const QString & value) override;
private:
	QString pattern;
};

class MULTIMC_LOGIC_EXPORT RegexpFilter: public Filter
{
public:
	RegexpFilter(const QString &regexp, bool invert);
	virtual ~RegexpFilter();
	bool accepts(const QString & value) override;
private:
	QRegularExpression pattern;
	bool invert = false;
};