summaryrefslogtreecommitdiff
path: root/regexp.h
blob: 4e00897be3a179bc12542c7332959215759a4ddd (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
/*
 * regexp.h: Regular expression list item
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef __EPGFIXER_REGEXP_H_
#define __EPGFIXER_REGEXP_H_

#include "tools.h"
#include <vdr/epg.h>
#include <vdr/tools.h>
#include <stdio.h>

#ifdef HAVE_PCREPOSIX
#include <pcre.h>
#endif

typedef enum { REGEXP_TITLE,REGEXP_SHORTTEXT,REGEXP_DESCRIPTION,REGEXP_UNDEFINED } sources;

class cRegexp : public cListItem
{
private:
  char *regexp;
  int source;
  pcre *re;
  pcre_extra *sd;
  void Compile();
  void FreeCompiled();
public:
  cRegexp();
  virtual ~cRegexp();
  virtual bool Apply(cEvent *Event);
  void SetFromString(char *string, bool Enabled);
  int GetSource() { return source; };
  void ToggleEnabled(void);
  virtual void PrintConfigLineToFile(FILE *f);
};

// Global instance
extern cEpgfixerList<cRegexp> EpgfixerRegexps;

#endif //__EPGFIXER_REGEXP_H_