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