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  [[nodiscard]] virtual std::string_view optionHelp() const = 0;
16 
17 protected:
18  ~CLIOption() = default;
19  [[nodiscard]] static std::string getArgument(
20  const std::string& option, span<std::string>& cmdLine);
21  [[nodiscard]] static std::string peekArgument(const span<std::string>& cmdLine);
22 };
23 
25 {
26 public:
27  virtual void parseFileType(const std::string& filename,
28  span<std::string>& cmdLine) = 0;
29  [[nodiscard]] virtual std::string_view fileTypeCategoryName() const = 0;
30  [[nodiscard]] virtual std::string_view fileTypeHelp() const = 0;
31 
32 protected:
33  ~CLIFileType() = default;
34 };
35 
36 } // namespace openmsx
37 
38 #endif
virtual std::string_view fileTypeCategoryName() const =0
virtual void parseFileType(const std::string &filename, span< std::string > &cmdLine)=0
virtual std::string_view fileTypeHelp() const =0
static std::string getArgument(const std::string &option, span< std::string > &cmdLine)
Definition: CLIOption.cc:11
~CLIOption()=default
static std::string peekArgument(const span< std::string > &cmdLine)
Definition: CLIOption.cc:21
virtual std::string_view optionHelp() const =0
virtual void parseOption(const std::string &option, span< std::string > &cmdLine)=0
virtual void parseDone()
Definition: CLIOption.hh:14
Definition: span.hh:126
This file implemented 3 utility functions:
Definition: Autofire.cc:5
constexpr const char *const filename