summaryrefslogtreecommitdiff
path: root/setup.h
blob: 0933ea2c459be570d9e88f9d5ee431a7b73b7baf (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
#ifndef VDR_LIVE_SETUP_H
#define VDR_LIVE_SETUP_H

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

namespace vdrlive {

class Setup
{
	friend Setup& LiveSetup();

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

	// commandline
	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; }
	int GetScreenshotInterval() const { return m_screenshotInterval; }

	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 options
	int m_serverPort;
	IpList m_serverIps;
	// setup options
	int m_lastChannel;
	int m_screenshotInterval;

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

} // namespace vdrlive

#endif // VDR_LIVE_SETUP_H