From c31263388a5dbdc5150595b328d50fa486b4dce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matti=20Lehtim=C3=A4ki?= Date: Thu, 12 Apr 2012 19:25:00 +0300 Subject: Import version 0.0.4 to git. --- regexp.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 regexp.h (limited to 'regexp.h') diff --git a/regexp.h b/regexp.h new file mode 100644 index 0000000..1062133 --- /dev/null +++ b/regexp.h @@ -0,0 +1,79 @@ +/* + * regexp.h: Regular expression list + * + * See the README file for copyright information and how to reach the author. + * + */ + +#ifndef _REGEXP_H_ +#define _REGEXP_H_ + +#include + +#ifdef HAVE_PCREPOSIX +#include +#endif + +typedef enum { REGEXP_TITLE,REGEXP_SHORTTEXT,REGEXP_DESCRIPTION,REGEXP_UNDEFINED } sources; +extern const char *strSources[]; + +class cRegexp : public cListObject +{ +private: + bool enabled; + char *error; + int erroffset; + char *regexp; + char *string; + int source; + pcre *re; + pcre_extra *sd; + int numchannels; + int *channels; + void Free(); +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; } + void ToggleEnabled(void); + int NumChannels() { return numchannels; } + int GetChannel(int index); + int GetSource(void) { return source; } + pcre *GetRe(void) { return re; } + pcre_extra *GetSd(void) { return sd; } +}; + +class cRegexpList : public cList +{ +public: + void Clear(void) + { + cList::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); +}; + +// Global instance +extern cEpgfixerRegexps EpgfixerRegexps; + +#endif //_REGEXP_H_ -- cgit v1.2.3