diff options
author | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2012-05-05 12:30:22 +0300 |
---|---|---|
committer | Matti Lehtimäki <matti.lehtimaki@gmail.com> | 2012-05-05 12:30:22 +0300 |
commit | 3edad9d50e13e140dc0fa1ef1323c7b80e325a78 (patch) | |
tree | b7c4d9e63a5bf0afae3c16aacf86bfa963c7ea55 /tools.h | |
parent | 8877487555503d3615a4b17f9a9809fec2e28944 (diff) | |
download | vdr-plugin-epgfixer-3edad9d50e13e140dc0fa1ef1323c7b80e325a78.tar.gz vdr-plugin-epgfixer-3edad9d50e13e140dc0fa1ef1323c7b80e325a78.tar.bz2 |
Several bugs fixes. Code cleanup. Update history.
Diffstat (limited to 'tools.h')
-rw-r--r-- | tools.h | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -5,16 +5,17 @@ * */ -#ifndef _STRINGTOOLS_H_ -#define _STRINGTOOLS_H_ +#ifndef __EPGFIXER_STRINGTOOLS_H_ +#define __EPGFIXER_STRINGTOOLS_H_ +#include <vdr/epg.h> #include <vdr/tools.h> #include <unistd.h> #include <stdio.h> +#define FREE(x) { free(x); x = NULL; } + char *striphtml(char *str); -int count(const char *string, const char separator); -int loadChannelsFromString(const char *string, int **channels_num, char ***channels_str); class cListItem : public cListObject { @@ -27,14 +28,16 @@ protected: void Free(); const char *GetChannelID(int index); int GetChannelNum(int index); + int LoadChannelsFromString(const char *string); + bool IsActive(tChannelID ChannelID); public: cListItem(); virtual ~cListItem(); + virtual bool Apply(cEvent *Event) { return 0; } void SetFromString(char *string, bool Enabled); const char *GetString() { return string; } bool Enabled(void) { return enabled; } void ToggleEnabled(void); - int NumChannels() { return numchannels; } virtual void PrintConfigLineToFIle(FILE *f) {} }; @@ -75,8 +78,22 @@ public: Clear(); return LoadConfigFile(fileName, AllowComments); } + bool Apply(cEvent *Event) + { + int res = false; + T *item = (T *)(cList<T>::First()); + while (item) { + if (item->Enabled()) { + int ret = item->Apply(Event); + if (ret && !res) + res = true; + } + item = (T *)(item->Next()); + } + return res; + } void SetConfigFile(const char *FileName) { fileName = strdup(FileName); } const char *GetConfigFile() { return fileName; } }; -#endif //_STRINGTOOLS_H_ +#endif //__EPGFIXER_STRINGTOOLS_H_ |