vdr
2.4.1
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
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
);
24
if
(!
Sources
.
ContainsSourceType
(
source
))
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
34
cSourceParams
SourceParams
;
35
36
cSourceParam
*
cSourceParams::Get
(
char
Source)
37
{
38
for
(
cSourceParam
*sp =
First
(); sp; sp =
Next
(sp)) {
39
if
(sp->Source() == Source)
40
return
sp;
41
}
42
return
NULL;
43
}
sources.h
cListBase::Add
void Add(cListObject *Object, cListObject *After=NULL)
Definition:
tools.c:2152
cSourceParams
Definition:
sourceparams.h:46
cSource
Definition:
sources.h:15
Sources
cSources Sources
Definition:
sources.c:117
cList< cSourceParam >::First
const cSourceParam * First(void) const
Returns the first element in this list, or NULL if the list is empty.
Definition:
tools.h:606
dsyslog
#define dsyslog(a...)
Definition:
tools.h:37
cSourceParams::Get
cSourceParam * Get(char Source)
Definition:
sourceparams.c:36
cSourceParam::Source
char Source(void) const
Definition:
sourceparams.h:31
sourceparams.h
cSourceParam::source
char source
Definition:
sourceparams.h:19
cSourceParam
Definition:
sourceparams.h:17
SourceParams
cSourceParams SourceParams
Definition:
sourceparams.c:34
cList< cSourceParam >::Next
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:613
cSourceParam::cSourceParam
cSourceParam(char Source, const char *Description)
Sets up a parameter handler for the given Source.
Definition:
sourceparams.c:15
esyslog
#define esyslog(a...)
Definition:
tools.h:35
cSources::ContainsSourceType
bool ContainsSourceType(char SourceType)
Definition:
sources.c:128
Generated by
1.8.18