summaryrefslogtreecommitdiff
path: root/regexp.h
blob: 25efae96473b8fe443aae11afaf4d9bc2f901315 (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
/*
 * 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_

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

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

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

class cRegexp : public cListItem
{
private:
  char *regexp;
  char *replacement;
  int replace;
  int modifiers;
  int source;
  pcre *re;
  pcre_extra *sd;
  void Compile();
  void FreeCompiled();
  int ParseModifiers(char *modstring, int substitution = 0);
  void ParseRegexp(char *restring);

public:
  cRegexp();
  virtual ~cRegexp();
  using cListItem::Apply;
  virtual bool Apply(cEvent *Event);
  void SetFromString(char *string, bool Enabled);
  int GetSource() { return source; };
  void ToggleEnabled(void);
};

// Global instance
extern cEpgfixerList<cRegexp, cEvent> EpgfixerRegexps;

#endif //__EPGFIXER_REGEXP_H_