openMSX
VideoSourceSetting.hh
Go to the documentation of this file.
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 
23 private:
24  [[nodiscard]] std::vector<std::string_view> getPossibleValues() const;
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 
38 {
39 public:
41  VideoSourceSetting& setting, const std::string& name);
43  [[nodiscard]] int getID() const { return id; }
44 
45 private:
47  int id;
48 };
49 
50 } // namespace openmsx
51 
52 #endif
BaseSetting * setting
Definition: Interpreter.cc:27
uintptr_t id
Definition: Interpreter.cc:26
VideoSourceActivator(VideoSourceSetting &setting, const std::string &name)
void tabCompletion(std::vector< std::string > &tokens) const override
Complete a partly typed value.
void unregisterVideoSource(int source)
void additionalInfo(TclObject &result) const override
Helper method for info().
VideoSourceSetting(CommandController &commandController)
std::string_view getTypeString() const override
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an ...
int registerVideoSource(const std::string &source)
This file implemented 3 utility functions:
Definition: Autofire.cc:9