summaryrefslogtreecommitdiff
path: root/setup.h
blob: dba4008400331612321a056b947e30382199f487 (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
54
55
56
#ifndef VDR_LIVE_SETUP_H
#define VDR_LIVE_SETUP_H

#include <list>
#include <numeric>
#include <string>
#include "live.h"

namespace vdrlive {

class Plugin;

class Setup
{
	friend Setup& Plugin::GetLiveSetup();

public:
	typedef std::list< std::string > IpList;

	// commandline
	std::string const& GetLibraryPath() const { return m_libraryPath; }
	int GetServerPort() const { return m_serverPort; }
	IpList const& GetServerIps() const { return m_serverIps; }
	// vdr-setup
	int GetLastChannel() const { return m_lastChannel == 0 ? std::numeric_limits< int >::max() : m_lastChannel; }

	bool ParseCommandLine( int argc, char* argv[] );
	char const* CommandLineHelp() const;

	bool ParseSetupEntry( char const* name, char const* value );
	
private:
	Setup();
	Setup( Setup const& );

	mutable std::string m_helpString;
	// commandline
	std::string m_libraryPath;
	int m_serverPort;
	IpList m_serverIps;
	// vdr-setup
	int m_lastChannel;

	bool CheckLibraryPath();
	bool CheckServerPort();
	bool CheckServerIps();
};

inline Setup& LiveSetup()
{
	return LivePlugin().GetLiveSetup();
}

} // namespace vdrlive

#endif // VDR_LIVE_SETUP_H