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.hh"
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 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 string_view fileTypeHelp() const = 0;
30 
31 protected:
32  ~CLIFileType() = default;
33 };
34 
35 } // namespace openmsx
36 
37 #endif
std::string peekArgument(const span< std::string > &cmdLine) const
Definition: CLIOption.cc:21
Definition: span.hh:34
virtual string_view optionHelp() const =0
virtual void parseOption(const std::string &option, span< std::string > &cmdLine)=0
~CLIOption()=default
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
virtual void parseDone()
Definition: CLIOption.hh:14
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16
std::string getArgument(const std::string &option, span< std::string > &cmdLine) const
Definition: CLIOption.cc:11