vdr  1.7.27
sources.h
Go to the documentation of this file.
00001 /*
00002  * sources.h: Source handling
00003  *
00004  * See the main source file 'vdr.c' for copyright information and
00005  * how to reach the author.
00006  *
00007  * $Id: sources.h 2.3 2010/03/07 13:53:11 kls Exp $
00008  */
00009 
00010 #ifndef __SOURCES_H
00011 #define __SOURCES_H
00012 
00013 #include "config.h"
00014 
00015 class cSource : public cListObject {
00016 public:
00017   enum eSourceType {
00018     stNone  = 0x00000000,
00019     stAtsc  = ('A' << 24),
00020     stCable = ('C' << 24),
00021     stSat   = ('S' << 24),
00022     stTerr  = ('T' << 24),
00023     st_Mask = 0xFF000000,
00024     st_Pos  = 0x0000FFFF,
00025     };
00026 private:
00027   int code;
00028   char *description;
00029 public:
00030   cSource(void);
00031   cSource(char Source, const char *Description);
00032   ~cSource();
00033   int Code(void) const { return code; }
00034   const char *Description(void) const { return description; }
00035   bool Parse(const char *s);
00036   static cString ToString(int Code);
00037   static int FromString(const char *s);
00038   static int FromData(eSourceType SourceType, int Position = 0, bool East = false);
00039   static bool IsAtsc(int Code) { return (Code & st_Mask) == stAtsc; }
00040   static bool IsCable(int Code) { return (Code & st_Mask) == stCable; }
00041   static bool IsSat(int Code) { return (Code & st_Mask) == stSat; }
00042   static bool IsTerr(int Code) { return (Code & st_Mask) == stTerr; }
00043   static bool IsType(int Code, char Source) { return int(Code & st_Mask) == (int(Source) << 24); }
00044   };
00045 
00046 class cSources : public cConfig<cSource> {
00047 public:
00048   cSource *Get(int Code);
00049   };
00050 
00051 extern cSources Sources;
00052 
00053 #endif //__SOURCES_H