summaryrefslogtreecommitdiff
path: root/timers.h
diff options
context:
space:
mode:
Diffstat (limited to 'timers.h')
-rw-r--r--timers.h50
1 files changed, 27 insertions, 23 deletions
diff --git a/timers.h b/timers.h
index 7dcaf16..ae83f5b 100644
--- a/timers.h
+++ b/timers.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: timers.h 1.13 2004/12/26 12:21:29 kls Exp $
+ * $Id: timers.h 1.18 2005/03/20 14:47:45 kls Exp $
*/
#ifndef __TIMERS_H
@@ -30,14 +30,15 @@ private:
bool recording, pending, inVpsMargin;
int flags;
cChannel *channel;
- int day;
+ mutable time_t day; ///< midnight of the day this timer shall hit, or of the first day it shall hit in case of a repeating timer
+ int weekdays; ///< bitmask, lowest bits: SSFTWTM (the 'M' is the LSB)
int start;
int stop;
int priority;
int lifetime;
char file[MaxFileName];
- mutable time_t firstday;
char *summary;
+ const cSchedule *schedule;
const cEvent *event;
public:
cTimer(bool Instant = false, bool Pause = false);
@@ -45,36 +46,38 @@ public:
virtual ~cTimer();
cTimer& operator= (const cTimer &Timer);
virtual int Compare(const cListObject &ListObject) const;
- bool Recording(void) { return recording; }
- bool Pending(void) { return pending; }
- bool InVpsMargin(void) { return inVpsMargin; }
- int Flags(void) { return flags; }
- const cChannel *Channel(void) { return channel; }
- int Day(void) { return day; }
- int Start(void) { return start; }
- int Stop(void) { return stop; }
- int Priority(void) { return priority; }
- int Lifetime(void) { return lifetime; }
- const char *File(void) { return file; }
- time_t FirstDay(void) { return firstday; }
- const char *Summary(void) { return summary; }
+ bool Recording(void) const { return recording; }
+ bool Pending(void) const { return pending; }
+ bool InVpsMargin(void) const { return inVpsMargin; }
+ int Flags(void) const { return flags; }
+ const cChannel *Channel(void) const { return channel; }
+ time_t Day(void) const { return day; }
+ int WeekDays(void) const { return weekdays; }
+ int Start(void) const { return start; }
+ int Stop(void) const { return stop; }
+ int Priority(void) const { return priority; }
+ int Lifetime(void) const { return lifetime; }
+ const char *File(void) const { return file; }
+ time_t FirstDay(void) const { return weekdays ? day : 0; }
+ const char *Summary(void) const { return summary; }
cString ToText(bool UseChannelID = false);
- const cEvent *Event(void) { return event; }
+ cString ToDescr(void) const;
+ const cEvent *Event(void) const { return event; }
bool Parse(const char *s);
bool Save(FILE *f);
bool IsSingleEvent(void) const;
static int GetMDay(time_t t);
static int GetWDay(time_t t);
- static int GetWDayFromMDay(int MDay);
bool DayMatches(time_t t) const;
static time_t IncDay(time_t t, int Days);
static time_t SetTime(time_t t, int SecondsFromMidnight);
char *SetFile(const char *File);
bool Matches(time_t t = 0, bool Directly = false) const;
- int Matches(const cEvent *Event);
+ int Matches(const cEvent *Event, int *Overlap = NULL) const;
+ bool Expired(void) const;
time_t StartTime(void) const;
time_t StopTime(void) const;
- void SetEvent(const cEvent *Event);
+ void SetEvent(const cSchedule *Schedule, const cEvent *Event);
void SetRecording(bool Recording);
void SetPending(bool Pending);
void SetInVpsMargin(bool InVpsMargin);
@@ -84,10 +87,10 @@ public:
bool HasFlags(int Flags) const;
void Skip(void);
void OnOff(void);
- cString PrintFirstDay(void);
+ cString PrintFirstDay(void) const;
static int TimeToInt(int t);
- static int ParseDay(const char *s, time_t *FirstDay = NULL);
- static cString PrintDay(int d, time_t FirstDay = 0);
+ static bool ParseDay(const char *s, time_t &Day, int &WeekDays);
+ static cString PrintDay(time_t Day, int WeekDays);
};
class cTimers : public cConfig<cTimer> {
@@ -109,6 +112,7 @@ public:
///< Returns true if any of the timers have been modified.
///< Calling this function resets the 'modified' flag to false.
void SetEvents(void);
+ void DeleteExpired(void);
};
extern cTimers Timers;