openMSX
CLIOption.cc
Go to the documentation of this file.
1#include "CLIOption.hh"
2#include "MSXException.hh"
3#include <utility>
4
5namespace openmsx {
6
7// class CLIOption
8
9std::string CLIOption::getArgument(const std::string& option, std::span<std::string>& cmdLine)
10{
11 if (cmdLine.empty()) {
12 throw FatalError("Missing argument for option \"", option, '\"');
13 }
14 std::string argument = std::move(cmdLine.front());
15 cmdLine = cmdLine.subspan(1);
16 return argument;
17}
18
19std::string CLIOption::peekArgument(const std::span<std::string>& cmdLine)
20{
21 return cmdLine.empty() ? std::string{} : cmdLine.front();
22}
23
24} // namespace openmsx
static std::string getArgument(const std::string &option, std::span< std::string > &cmdLine)
Definition CLIOption.cc:9
static std::string peekArgument(const std::span< std::string > &cmdLine)
Definition CLIOption.cc:19
This file implemented 3 utility functions:
Definition Autofire.cc:11