summaryrefslogtreecommitdiff
path: root/timers.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2002-10-20 12:28:55 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2002-10-20 12:28:55 +0200
commitac9622bb8ad8d660fca4e77460c970f72c344afa (patch)
tree9738265846abf2c1a491cfec77a4e55f434297be /timers.h
parentab4ceb29a033f8a3cc051d5ea9a6f20ca6e75f8a (diff)
downloadvdr-ac9622bb8ad8d660fca4e77460c970f72c344afa.tar.gz
vdr-ac9622bb8ad8d660fca4e77460c970f72c344afa.tar.bz2
Timers now internally have a pointer to their channel
Diffstat (limited to 'timers.h')
-rw-r--r--timers.h91
1 files changed, 91 insertions, 0 deletions
diff --git a/timers.h b/timers.h
new file mode 100644
index 00000000..8dc762e3
--- /dev/null
+++ b/timers.h
@@ -0,0 +1,91 @@
+/*
+ * timers.h: Timer handling
+ *
+ * See the main source file 'vdr.c' for copyright information and
+ * how to reach the author.
+ *
+ * $Id: timers.h 1.1 2002/10/20 11:52:23 kls Exp $
+ */
+
+#ifndef __TIMERS_H
+#define __TIMERS_H
+
+#include "channels.h"
+#include "config.h"
+#include "tools.h"
+
+enum eTimerActive { taInactive = 0,
+ taActive = 1,
+ taInstant = 2,
+ taActInst = (taActive | taInstant)
+ };
+
+class cTimer : public cListObject {
+ friend class cMenuEditTimer;
+private:
+ time_t startTime, stopTime;
+ static char *buffer;
+ bool recording, pending;
+ int active;
+ cChannel *channel;
+ int day;
+ int start;
+ int stop;
+ int priority;
+ int lifetime;
+ char file[MaxFileName];
+ time_t firstday;
+ char *summary;
+ static const char *ToText(cTimer *Timer);
+public:
+ cTimer(bool Instant = false);
+ cTimer(const cEventInfo *EventInfo);
+ virtual ~cTimer();
+ cTimer& operator= (const cTimer &Timer);
+ virtual bool operator< (const cListObject &ListObject);
+ bool Recording(void) { return recording; }
+ bool Pending(void) { return pending; }
+ int Active(void) { return active; }
+ 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; }
+ const char *ToText(void);
+ bool Parse(const char *s);
+ bool Save(FILE *f);
+ bool IsSingleEvent(void);
+ int GetMDay(time_t t);
+ int GetWDay(time_t t);
+ bool DayMatches(time_t t);
+ 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);
+ time_t StartTime(void);
+ time_t StopTime(void);
+ void SetRecording(bool Recording);
+ void SetPending(bool Pending);
+ void SetActive(int Active);
+ void Skip(void);
+ void OnOff(void);
+ const char *PrintFirstDay(void);
+ static int TimeToInt(int t);
+ static int ParseDay(const char *s, time_t *FirstDay = NULL);
+ static const char *PrintDay(int d, time_t FirstDay = 0);
+ };
+
+class cTimers : public cConfig<cTimer> {
+public:
+ cTimer *GetTimer(cTimer *Timer);
+ cTimer *GetMatch(time_t t);
+ cTimer *GetNextActiveTimer(void);
+ };
+
+extern cTimers Timers;
+
+#endif //__TIMERS_H