| 1 |
#ifndef CLIOPTION_HH |
| 2 |
#define CLIOPTION_HH |
| 3 |
|
| 4 |
#include <span> |
| 5 |
#include <string> |
| 6 |
#include <string_view> |
| 7 |
|
| 8 |
namespace openmsx { |
| 9 |
|
| 10 |
class CLIOption |
| 11 |
{ |
| 12 |
public: |
| 13 |
CLIOption(const CLIOption&) = delete; |
| 14 |
CLIOption(CLIOption&&) = delete; |
| 15 |
CLIOption& operator=(const CLIOption&) = delete; |
| 16 |
CLIOption& operator=(CLIOption&&) = delete; |
| 17 |
|
| 18 |
virtual void parseOption(const std::string& option, |
| 19 |
std::span<std::string>& cmdLine) = 0; |
| 20 |
virtual void parseDone() {} |
| 21 |
[[nodiscard]] virtual std::string_view optionHelp() const = 0; |
| 22 |
|
| 23 |
protected: |
| 24 |
CLIOption() = default; |
| 25 |
~CLIOption() = default; |
| 26 |
[[nodiscard]] static std::string getArgument( |
| 27 |
const std::string& option, std::span<std::string>& cmdLine); |
| 28 |
[[nodiscard]] static std::string peekArgument(const std::span<std::string>& cmdLine); |
| 29 |
}; |
| 30 |
|
| 31 |
class CLIFileType |
| 32 |
{ |
| 33 |
public: |
| 34 |
CLIFileType(const CLIFileType&) = delete; |
| 35 |
CLIFileType(CLIFileType&&) = delete; |
| 36 |
CLIFileType& operator=(const CLIFileType&) = delete; |
| 37 |
CLIFileType& operator=(CLIFileType&&) = delete; |
| 38 |
|
| 39 |
virtual void parseFileType(const std::string& filename, |
| 40 |
std::span<std::string>& cmdLine) = 0; |
| 41 |
[[nodiscard]] virtual std::string_view fileTypeCategoryName() const = 0; |
| 42 |
[[nodiscard]] virtual std::string_view fileTypeHelp() const = 0; |
| 43 |
|
| 44 |
protected: |
| 45 |
CLIFileType() = default; |
| 46 |
~CLIFileType() = default; |
| 47 |
}; |
| 48 |
|
| 49 |
} |
| 50 |
|
| 51 |
#endif |