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 #include <utility>
7 
8 namespace openmsx {
9 
10 class VideoSourceSetting final : public Setting
11 {
12 public:
13  explicit VideoSourceSetting(CommandController& commandController);
14 
15  string_view getTypeString() const override;
16  void additionalInfo(TclObject& result) const override;
17  void tabCompletion(std::vector<std::string>& tokens) const override;
18 
19  int registerVideoSource(const std::string& source);
20  void unregisterVideoSource(int source);
21  int getSource() noexcept;
22  void setSource(int id);
23 
24 private:
25  std::vector<string_view> getPossibleValues() const;
26  void checkSetValue(string_view value) const;
27  bool has(int value) const;
28  int has(string_view value) const;
29 
30  using Sources = std::vector<std::pair<std::string, int>>;
31  Sources sources; // unordered
32 };
33 
35 {
36 public:
38  VideoSourceSetting& setting, const std::string& name);
40  int getID() const { return id; }
41 private:
42  VideoSourceSetting& setting;
43  int id;
44 };
45 
46 } // namespace openmsx
47 
48 #endif
void additionalInfo(TclObject &result) const override
Helper method for info().
int registerVideoSource(const std::string &source)
string_view getTypeString() const override
Returns a string describing the setting type (integer, string, ..) Could be used in a GUI to pick an ...
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void tabCompletion(std::vector< std::string > &tokens) const override
Complete a partly typed value.
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16
VideoSourceSetting(CommandController &commandController)
void unregisterVideoSource(int source)