1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00
vdr/sources.h

56 lines
1.5 KiB
C
Raw Normal View History

/*
* 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.1.1 2014/03/09 12:13:34 kls Exp $
*/
#ifndef __SOURCES_H
#define __SOURCES_H
#include "config.h"
class cSource : public cListObject {
public:
enum eSourceType {
2010-02-28 12:19:50 +01:00
stNone = 0x00000000,
2010-03-06 12:01:17 +01:00
stAtsc = ('A' << 24),
2010-02-28 12:19:50 +01:00
stCable = ('C' << 24),
stSat = ('S' << 24),
stTerr = ('T' << 24),
st_Mask = 0xFF000000,
st_Pos = 0x0000FFFF,
};
private:
int code;
char *description;
public:
cSource(void);
2010-02-28 12:19:50 +01:00
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);
2010-03-06 12:01:17 +01:00
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);
bool ContainsSourceType(char SourceType);
};
extern cSources Sources;
#endif //__SOURCES_H