vdr  2.0.7
sources.h
Go to the documentation of this file.
1 /*
2  * sources.h: Source handling
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: sources.h 2.4.1.1 2014/03/09 12:13:34 kls Exp $
8  */
9 
10 #ifndef __SOURCES_H
11 #define __SOURCES_H
12 
13 #include "config.h"
14 
15 class cSource : public cListObject {
16 public:
17  enum eSourceType {
18  stNone = 0x00000000,
19  stAtsc = ('A' << 24),
20  stCable = ('C' << 24),
21  stSat = ('S' << 24),
22  stTerr = ('T' << 24),
23  st_Mask = 0xFF000000,
24  st_Pos = 0x0000FFFF,
25  };
26 private:
27  int code;
28  char *description;
29 public:
30  cSource(void);
31  cSource(char Source, const char *Description);
32  ~cSource();
33  int Code(void) const { return code; }
34  const char *Description(void) const { return description; }
35  bool Parse(const char *s);
36  static char ToChar(int Code) { return (Code & st_Mask) >> 24; }
37  static cString ToString(int Code);
38  static int FromString(const char *s);
39  static int FromData(eSourceType SourceType, int Position = 0, bool East = false);
40  static bool IsAtsc(int Code) { return (Code & st_Mask) == stAtsc; }
41  static bool IsCable(int Code) { return (Code & st_Mask) == stCable; }
42  static bool IsSat(int Code) { return (Code & st_Mask) == stSat; }
43  static bool IsTerr(int Code) { return (Code & st_Mask) == stTerr; }
44  static bool IsType(int Code, char Source) { return int(Code & st_Mask) == (int(Source) << 24); }
45  };
46 
47 class cSources : public cConfig<cSource> {
48 public:
49  cSource *Get(int Code);
50  bool ContainsSourceType(char SourceType);
51  };
52 
53 extern cSources Sources;
54 
55 #endif //__SOURCES_H
static cString ToString(int Code)
Definition: sources.c:40
static char ToChar(int Code)
Definition: sources.h:36
static bool IsTerr(int Code)
Definition: sources.h:43
int Code(void) const
Definition: sources.h:33
bool Parse(const char *s)
Definition: sources.c:31
~cSource()
Definition: sources.c:26
int code
Definition: sources.h:27
static bool IsAtsc(int Code)
Definition: sources.h:40
static bool IsSat(int Code)
Definition: sources.h:42
eSourceType
Definition: sources.h:17
const char * Description(void) const
Definition: sources.h:34
static bool IsType(int Code, char Source)
Definition: sources.h:44
bool ContainsSourceType(char SourceType)
Definition: sources.c:116
static int FromString(const char *s)
Definition: sources.c:56
static bool IsCable(int Code)
Definition: sources.h:41
cSource(void)
Definition: sources.c:14
cSource * Get(int Code)
Definition: sources.c:107
static int FromData(eSourceType SourceType, int Position=0, bool East=false)
Definition: sources.c:92
cSources Sources
Definition: sources.c:105
char * description
Definition: sources.h:28
Definition: tools.h:166