diff options
Diffstat (limited to 'regexp.h')
-rw-r--r-- | regexp.h | 55 |
1 files changed, 12 insertions, 43 deletions
@@ -1,5 +1,5 @@ /* - * regexp.h: Regular expression list + * regexp.h: Regular expression list item * * See the README file for copyright information and how to reach the author. * @@ -8,68 +8,37 @@ #ifndef _REGEXP_H_ #define _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; -extern const char *strSources[]; -class cRegexp : public cListObject +class cRegexp : public cListItem { private: - bool enabled; char *regexp; - char *string; - int *channels_num; - char **channels_str; - int numchannels; int source; pcre *re; pcre_extra *sd; - void Free(); + void Compile(); + void FreeCompiled(); public: cRegexp(); - cRegexp(int Source, const char *Regex, bool Enabled, bool Precompile); virtual ~cRegexp(); - void SetFromString(char *string, bool Enabled, bool Precompile); - const char *GetString() { return string; } - void Compile(); - void FreeCompiled(); - bool Enabled(void) { return enabled; } + bool Apply(cEvent *Event); + void SetFromString(char *string, bool Enabled); + int GetSource() { return source; }; void ToggleEnabled(void); - int NumChannels() { return numchannels; } - int GetChannelNum(int index); - const char *GetChannelID(int index); - int GetSource(void) { return source; } - pcre *GetRe(void) { return re; } - pcre_extra *GetSd(void) { return sd; } -}; - -class cRegexpList : public cList<cRegexp> -{ -public: - void Clear(void) { cList<cRegexp>::Clear(); } - cRegexpList(void) {} -}; - -class cEpgfixerRegexps -{ -private: - bool LoadRegexps(const char *FileName = NULL, bool AllowComments = true, bool Precompile = true); - char *fileName; -public: - cRegexpList *regexps; - cEpgfixerRegexps(); - ~cEpgfixerRegexps(); - void SetRegexpConfigFile(const char *FileName); - const char *RegexpConfigFile(); - bool ReloadRegexps(bool AllowComments = true, bool Precompile = true); + virtual void PrintConfigLineToFile(FILE *f); }; // Global instance -extern cEpgfixerRegexps EpgfixerRegexps; +extern cEpgfixerList<cRegexp> EpgfixerRegexps; #endif //_REGEXP_H_ |