summaryrefslogtreecommitdiff
path: root/sourceparams.h
blob: 1e0a6abccacebce88a690c2c1365cb3344a621b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * sourceparams.h: Source parameter handling
 *
 * See the main source file 'vdr.c' for copyright information and
 * how to reach the author.
 *
 * $Id: sourceparams.h 4.1 2015/08/02 11:56:25 kls Exp $
 */

#ifndef __SOURCEPARAMS_H
#define __SOURCEPARAMS_H

#include "channels.h"
#include "osdbase.h"
#include "tools.h"

class cSourceParam : public cListObject {
private:
  char source;
public:
  cSourceParam(char Source, const char *Description);
    ///< Sets up a parameter handler for the given Source.
    ///< Source must be in the range 'A'...'Z', and there can only
    ///< be one cSourceParam for any given source.
    ///< Description contains a short, one line description of this source.
    ///< If a plugin sets up a new cSourceParam, this will also trigger
    ///< defining the appropriate cSource automatically.
    ///< Objects of cSourceParam shall only be created on the heap, and
    ///< shall never be deleted (they will be deleted automatically when
    ///< the program ends).
  char Source(void) const { return source; }
  virtual void SetData(cChannel *Channel) = 0;
    ///< Sets all source specific parameters to those of the given Channel.
    ///< Must also reset a counter to use with later calls to GetOsdItem().
  virtual void GetData(cChannel *Channel) = 0;
    ///< Copies all source specific parameters to the given Channel.
  virtual cOsdItem *GetOsdItem(void) = 0;
    ///< Returns all the OSD items necessary for editing the source
    ///< specific parameters of the channel that was given in the last
    ///< call to SetData(). Each call to GetOsdItem() returns exactly
    ///< one such item. After all items have been fetched, any further
    ///< calls to GetOsdItem() return NULL. After another call to
    ///< SetData(), the OSD items can be fetched again.
  };

class cSourceParams : public cList<cSourceParam> {
public:
  cSourceParam *Get(char Source);
  };

extern cSourceParams SourceParams;

#endif //__SOURCEPARAMS_H