blob: 280ef64ba48b455b8a896d7a093ff0826c1bd4e6 (
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
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
|
/**
* based on event.h,v 1.1.1.1 2006/02/26 14:11:02 lordjaxom
*
* version by Midas
*
*/
#ifndef VDR_BLOCK_EVENT_H
#define VDR_BLOCK_EVENT_H
#include <regex.h>
#include <vdr/config.h>
#define EVLINELENGTH 256
class cEventBlock : public cListObject {
friend class cMenuSetupEditBlock;
private:
char mPattern[EVLINELENGTH];
int mRegularExp;
int mIgnoreCase;
bool mCompiled;
int whitelisted;
regex_t mExpression;
public:
cEventBlock(void);
cEventBlock(const char *Pattern);
cEventBlock(const cEventBlock &Src);
~cEventBlock();
cEventBlock &operator=(const cEventBlock &Src);
bool operator==(const cEventBlock Src);
bool doesMatch(const char *Event) const ;
const int isWhitelisted(void) const {return whitelisted;}
void setWhitelisted(const bool b) {whitelisted=b;}
bool IgnoreCase(void) const {return mIgnoreCase;}
void setIgnoreCase(const bool b) {mIgnoreCase=b;}
bool Parse(char *s);
bool Compile(void);
bool Save(FILE *f);
static const char *LastTitle;
static const bool *ReplayingRecording;
static char *duptolower(const char*);
const char *Pattern(void) const { return mPattern; }
virtual int Compare(const cListObject &src) const
{
cEventBlock* rhs=(cEventBlock*)&src;
char* l=cEventBlock::duptolower(mPattern);
char* r=cEventBlock::duptolower(rhs->mPattern);
return strcmp(l,r); }//TODO check if the code relies on this because in fact we have to return !strcmp(r,l) here!!!
};
class cEventsBlock : public cConfig<cEventBlock> {
private:
// int recursive_pos_seek (char *pattern, int start);
public:
bool Acceptable(const char *Event);
cEventsBlock &operator=(const cEventsBlock &Source);
void ListMatches (const char *src, cVector <cEventBlock*> *match_vec, cEventBlock &stringmatch);
void ListMatches (const char *src, cVector <cEventBlock*> *match_vec);
cEventBlock* hasStringMatch(const char* src, bool ignorecase=false);
int getIndexOf(cEventBlock *Src);
};
extern cEventsBlock EventsBlock;
#endif // VDR_BLOCK_EVENT_H
|