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