vdr 2.6.6
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 4.1 2015/08/02 11:56:39 kls Exp $
8 */
9
10#include "sourceparams.h"
11#include "sources.h"
12
13// --- cSourceParam ----------------------------------------------------------
14
15cSourceParam::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}
void Add(cListObject *Object, cListObject *After=NULL)
Definition tools.c:2212
const cSourceParam * First(void) const
Returns the first element in this list, or NULL if the list is empty.
Definition tools.h:656
const cSourceParam * Next(const cSourceParam *Object) const
< Returns the element immediately before Object in this list, or NULL if Object is the first element ...
Definition tools.h:663
char Source(void) const
cSourceParam(char Source, const char *Description)
Sets up a parameter handler for the given Source.
cSourceParam * Get(char Source)
bool ContainsSourceType(char SourceType)
Definition sources.c:128
cSourceParams SourceParams
cSourceParams SourceParams
cSources Sources
Definition sources.c:117
#define dsyslog(a...)
Definition tools.h:37
#define esyslog(a...)
Definition tools.h:35