vdr  2.2.0
sourceparams.c
Go to the documentation of this file.
1 /*
2  * sourceparams.c: Source parameter handling
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: sourceparams.c 3.1 2014/03/09 12:03:09 kls Exp $
8  */
9 
10 #include "sourceparams.h"
11 #include "sources.h"
12 
13 // --- cSourceParam ----------------------------------------------------------
14 
15 cSourceParam::cSourceParam(char Source, const char *Description)
16 {
17  source = Source;
18  if ('A' <= source && source <= 'Z') {
19  if (SourceParams.Get(source)) {
20  esyslog("ERROR: source parameters for '%c' already defined", source);
21  return;
22  }
23  SourceParams.Add(this);
25  Sources.Add(new cSource(source, Description));
26  dsyslog("registered source parameters for '%c - %s'", source, Description);
27  }
28  else
29  esyslog("ERROR: invalid source '%c'", source);
30 }
31 
32 // --- cSourceParams ---------------------------------------------------------
33 
35 
37 {
38  for (cSourceParam *sp = First(); sp; sp = Next(sp)) {
39  if (sp->Source() == Source)
40  return sp;
41  }
42  return NULL;
43 }
#define dsyslog(a...)
Definition: tools.h:36
void Add(cListObject *Object, cListObject *After=NULL)
Definition: tools.c:2014
cSourceParam * Get(char Source) const
Definition: sourceparams.c:36
#define esyslog(a...)
Definition: tools.h:34
cListObject * Next(void) const
Definition: tools.h:468
cSources Sources
Definition: sources.c:117
cSourceParams SourceParams
Definition: sourceparams.c:34
cSourceParam(char Source, const char *Description)
Sets up a parameter handler for the given Source.
Definition: sourceparams.c:15
char Source(void) const
Definition: sourceparams.h:31
bool ContainsSourceType(char SourceType)
Definition: sources.c:128