vdr 2.7.4
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 3.3 2014/03/09 11:59:49 kls Exp $
8 */
9
10#ifndef __SOURCES_H
11#define __SOURCES_H
12
13#include "config.h"
14
15class cSource : public cListObject {
16public:
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 st_Any = 0x00000E10, // 3600 - special value indicating "any position"
26 };
27private:
28 int code;
30public:
31 cSource(void);
32 cSource(char Source, const char *Description);
33 ~cSource();
34 int Code(void) const { return code; }
35 int Position(void) { return Position(code); }
44 const char *Description(void) const { return description; }
45 bool Parse(const char *s);
46 static bool Matches(int Code1, int Code2);
50 static int Position(int Code);
51 static char ToChar(int Code) { return (Code & st_Mask) >> 24; }
52 static cString ToString(int Code);
53 static int FromString(const char *s);
54 static int FromData(eSourceType SourceType, int Position = 0, bool East = false);
55 static bool IsAtsc(int Code) { return (Code & st_Mask) == stAtsc; }
56 static bool IsCable(int Code) { return (Code & st_Mask) == stCable; }
57 static bool IsSat(int Code) { return (Code & st_Mask) == stSat; }
58 static bool IsTerr(int Code) { return (Code & st_Mask) == stTerr; }
59 static bool IsType(int Code, char Source) { return int(Code & st_Mask) == (int(Source) << 24); }
60 };
61
62class cSources : public cConfig<cSource> {
63public:
64 cSource *Get(int Code);
65 bool ContainsSourceType(char SourceType);
66 };
67
68extern cSources Sources;
69
70#endif //__SOURCES_H
cConfig(const char *NeedsLocking=NULL)
Definition config.h:126
cListObject(const cListObject &ListObject)
Definition tools.h:534
static bool IsType(int Code, char Source)
Definition sources.h:59
bool Parse(const char *s)
Definition sources.c:31
int Code(void) const
Definition sources.h:34
static int FromString(const char *s)
Definition sources.c:65
cSource(void)
Definition sources.c:14
static bool IsAtsc(int Code)
Definition sources.h:55
static bool IsTerr(int Code)
Definition sources.h:58
~cSource()
Definition sources.c:26
static cString ToString(int Code)
Definition sources.c:52
static bool IsCable(int Code)
Definition sources.h:56
int code
Definition sources.h:28
static char ToChar(int Code)
Definition sources.h:51
const char * Description(void) const
Definition sources.h:44
int Position(void)
Returns the orbital position of the satellite in case this is a DVB-S source (zero otherwise).
Definition sources.h:35
char * description
Definition sources.h:29
static bool IsSat(int Code)
Definition sources.h:57
eSourceType
Definition sources.h:17
@ st_Mask
Definition sources.h:23
@ stCable
Definition sources.h:20
@ stSat
Definition sources.h:21
@ stNone
Definition sources.h:18
@ stAtsc
Definition sources.h:19
@ st_Pos
Definition sources.h:24
@ st_Any
Definition sources.h:25
@ stTerr
Definition sources.h:22
static int FromData(eSourceType SourceType, int Position=0, bool East=false)
Definition sources.c:101
static bool Matches(int Code1, int Code2)
Returns true if Code2 matches Code1.
Definition sources.c:40
bool ContainsSourceType(char SourceType)
Definition sources.c:125
cSource * Get(int Code)
Definition sources.c:116
cSources Sources
Definition sources.c:114