openMSX
CLIOption.cc
Go to the documentation of this file.
1
#include "
CLIOption.hh
"
2
#include "
MSXException.hh
"
3
#include <utility>
4
5
namespace
openmsx
{
6
7
// class CLIOption
8
9
std::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
19
std::string
CLIOption::peekArgument
(
const
std::span<std::string>& cmdLine)
20
{
21
return
cmdLine.empty() ? std::string{} : cmdLine.front();
22
}
23
24
}
// namespace openmsx
CLIOption.hh
MSXException.hh
openmsx::CLIOption::getArgument
static std::string getArgument(const std::string &option, std::span< std::string > &cmdLine)
Definition
CLIOption.cc:9
openmsx::CLIOption::peekArgument
static std::string peekArgument(const std::span< std::string > &cmdLine)
Definition
CLIOption.cc:19
openmsx::FatalError
Definition
MSXException.hh:34
openmsx
This file implemented 3 utility functions:
Definition
Autofire.cc:11
Generated on Wed Oct 30 2024 13:13:37 for openMSX by
1.9.8