-
Notifications
You must be signed in to change notification settings - Fork 1
/
channelListFilter.h
160 lines (137 loc) · 4.86 KB
/
channelListFilter.h
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#ifndef CHANNELLISTFILTER_H
#define CHANNELLISTFILTER_H
#include <vdr/tools.h>
#include <vdr/channels.h>
/** ************ cChannelFilter ************************************************
*** Parent class of channel filters to be created
*** creates filters for channels in channel list
*******************************************************************************/
class cChannelFilter : public cListObject
{
protected:
cString name;
public:
cChannelFilter(const char* s);
virtual bool IsAllowed(const cChannel*) = 0;
virtual cString Name() const;
virtual cString ParamsToString() const = 0;
virtual cString ParamToSave() const = 0;
virtual bool ParseParamString(cString param) = 0;
}; // class cChannelFilter
/** ****************** cChannelFilters *****************************************
*** holds all channel filters that are to be applied to a channel when decided
*** whether this channel is to be shown or not.
*******************************************************************************/
class cChannelFilters : public cList<cChannelFilter>
{
private:
cString name; // is it globalChannel filter list or favourite filter list?
public:
cChannelFilters(const char* name_);
cString Name() const;
bool IsAllowed(const cChannel* channel);
void RemoveLastFilter();
cChannelFilters& operator=(cChannelFilters const &);
cString FilterNames() const;
cString FilterParamsToString() const;
cString LastFilterParam() const;
void Save() const;
bool AddFilterFromString(const char* filterName, const char* param);
};
/** ****************************************************************************
*** The following are subclasses of cChannelFilter
*** Each implements a single/specific filter
*** and are to be added to cChannelFilters as and when needed
*******************************************************************************/
/** text filter **************************************************************/
class cChannelTextFilter : public cChannelFilter
{
private:
cString filterByText;
public:
cChannelTextFilter();
void SetFilterParams(const cString& params);
bool IsAllowed(const cChannel* channel);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString param);
};
/** source/Satellite filter **************************************************/
class cChannelSourceFilter : public cChannelFilter
{
private:
int source;
public:
cChannelSourceFilter();
void SetFilterParams(int src);
bool IsAllowed(const cChannel* channel);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString param);
};
/** bouquet name filter *******************************************************
bouquet filter:
looks if bouquetName string is a substring of the bouquet of given channel
*******************************************************************************/
class cChannelBouquetFilter : public cChannelFilter
{
private:
cString bouquetName;
cChannels *channelList;
bool subStringMatch;
public:
cChannelBouquetFilter();
void SetFilterParams(const cString& bouquet, cChannels*, bool partialMatch=true );
bool IsAllowed(const cChannel* channel);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString);
};
/** provider name filter ******************************************************/
class cChannelProviderFilter : public cChannelFilter
{
private:
cString providerName;
public:
cChannelProviderFilter();
void SetFilterParams(const cString& provider);
bool IsAllowed(const cChannel* channel);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString);
};
/** Transponder filter ******************************************************/
class cChannelTransponderFilter : public cChannelFilter
{
private:
int source; /* source Code as in cSources */
int frequency;
public:
cChannelTransponderFilter();
void SetFilterParams(int src, int freq);
bool IsAllowed(const cChannel* channel);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString);
};
/** Radio channels filter **************************************************/
class cChannelRadioFilter : public cChannelFilter
{
public:
cChannelRadioFilter();
bool IsAllowed(const cChannel *);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString);
};
/** TV channels filter *****************************************************/
class cChannelTVFilter : public cChannelFilter
{
public:
cChannelTVFilter();
bool IsAllowed(const cChannel *);
cString ParamsToString() const;
virtual cString ParamToSave() const;
bool ParseParamString(cString);
};
#endif // CHANNELLISTFILTER_H