OXYGENHUB
◆ main openmsx / src / settings / VideoSourceSetting.hh
1.4 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef VIDEOSOURCESETTING_HH
2
#define VIDEOSOURCESETTING_HH
3
4
#include "Setting.hh"
5
#include <vector>
6
7
namespace openmsx {
8
9
class VideoSourceSetting final : public Setting
10
{
11
public:
12
	explicit VideoSourceSetting(CommandController& commandController);
13
14
	[[nodiscard]] std::string_view getTypeString() const override;
15
	void additionalInfo(TclObject& result) const override;
16
	void tabCompletion(std::vector<std::string>& tokens) const override;
17
18
	[[nodiscard]] int registerVideoSource(const std::string& source);
19
	void unregisterVideoSource(int source);
20
	[[nodiscard]] int getSource() noexcept;
21
	void setSource(int id);
22
	[[nodiscard]] std::vector<std::string_view> getPossibleValues() const;
23
24
private:
25
	void checkSetValue(std::string_view value) const;
26
	[[nodiscard]] bool has(int value) const;
27
	[[nodiscard]] int has(std::string_view value) const;
28
29
private:
30
	struct Source {
31
		std::string name;
32
		int id;
33
	};
34
	std::vector<Source> sources; // unordered
35
};
36
37
class VideoSourceActivator
38
{
39
public:
40
	VideoSourceActivator(VideoSourceSetting& setting, const std::string& name);
41
	VideoSourceActivator(const VideoSourceActivator&) = delete;
42
	VideoSourceActivator(VideoSourceActivator&&) = delete;
43
	VideoSourceActivator& operator=(const VideoSourceActivator&) = delete;
44
	VideoSourceActivator& operator=(VideoSourceActivator&&) = delete;
45
	~VideoSourceActivator();
46
47
	[[nodiscard]] int getID() const { return id; }
48
49
private:
50
	VideoSourceSetting& setting;
51
	int id;
52
};
53
54
} // namespace openmsx
55
56
#endif