summaryrefslogtreecommitdiffstats
path: root/api/logic/Filter.h
blob: 1ba48e482a741da3e627cb0d27d7d65b0211d98f (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;
};