openMSX
CLIOption.hh
Go to the documentation of this file.
1 #ifndef CLIOPTION_HH
2 #define CLIOPTION_HH
3 
4 #include "span.hh"
5 #include <string_view>
6 
7 namespace openmsx {
8 
9 class CLIOption
10 {
11 public:
12  virtual void parseOption(const std::string& option,
13  span<std::string>& cmdLine) = 0;
14  virtual void parseDone() {}
15  virtual std::string_view optionHelp() const = 0;
16 
17 protected:
18  ~CLIOption() = default;
19  std::string getArgument(const std::string& option,
20  span<std::string>& cmdLine) const;
21  std::string peekArgument(const span<std::string>& cmdLine) const;
22 };
23 
25 {
26 public:
27  virtual void parseFileType(const std::string& filename,
28  span<std::string>& cmdLine) = 0;
29  virtual std::string_view fileTypeHelp() const = 0;
30 
31 protected:
32  ~CLIFileType() = default;
33 };
34 
35 } // namespace openmsx
36 
37 #endif
openmsx::CLIOption
Definition: CLIOption.hh:9
openmsx::CLIOption::parseOption
virtual void parseOption(const std::string &option, span< std::string > &cmdLine)=0
openmsx::CLIFileType
Definition: CLIOption.hh:24
openmsx::CLIOption::peekArgument
std::string peekArgument(const span< std::string > &cmdLine) const
Definition: CLIOption.cc:21
openmsx::CLIOption::parseDone
virtual void parseDone()
Definition: CLIOption.hh:14
span
Definition: span.hh:34
openmsx::filename
constexpr const char *const filename
Definition: FirmwareSwitch.cc:10
span.hh
openmsx::CLIOption::optionHelp
virtual std::string_view optionHelp() const =0
openmsx::CLIOption::getArgument
std::string getArgument(const std::string &option, span< std::string > &cmdLine) const
Definition: CLIOption.cc:11
openmsx::CLIOption::~CLIOption
~CLIOption()=default
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
openmsx::CLIFileType::parseFileType
virtual void parseFileType(const std::string &filename, span< std::string > &cmdLine)=0
openmsx::CLIFileType::fileTypeHelp
virtual std::string_view fileTypeHelp() const =0
openmsx::CLIFileType::~CLIFileType
~CLIFileType()=default